Results 1 to 2 of 2
  1. #1
    luisx86 is offline Member
    Join Date
    Mar 2013
    Rep Power

    Default Java algorithm problem

    Hello everyone, I'm currently trying to develop a software using Java. Basecally I have to create a simple algorithm that retrives a file from a folder and it compares to others file in another folder. so far, I have created the algorithm below which compares one file to another. Can anyone suggest any good way of doing it? Also, is it a good idea to proceed this way? thanks in advance....


    public class Project_2{
    public static void main(String [] args)throws IOException{
    BufferedReader br3 = new BufferedReader(new FileReader("file_1.txt"));

    int y = 0;

    int lineSimilar1 = 0;
    String line1 ="";
    String line2 ="";
    int doc=0;
    while((line2 = br3.readLine()) != null ){

    BufferedReader br4 = new BufferedReader(new FileReader("file_2.txt"));

    while((line1 = br4.readLine()) != null){


    System.out.println("line not similar");


  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Java algorithm problem

    There are a ton of algorithms out there for document similarity. Which one you use, or whether your current approach is valid, entirely depends on your context.

    Also, when posting code, please use the code tags to preserve formatting.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

Similar Threads

  1. Algorithm problem.
    By luisx86 in forum New To Java
    Replies: 2
    Last Post: 03-25-2013, 01:43 AM
  2. Replies: 0
    Last Post: 03-20-2011, 01:17 AM
  3. Algorithm Problem
    By Aggy in forum New To Java
    Replies: 4
    Last Post: 01-21-2010, 11:00 PM
  4. Problem with algorithm
    By Albert in forum AWT / Swing
    Replies: 1
    Last Post: 07-13-2007, 03:31 PM
  5. Algorithm problem
    By Marcus in forum Advanced Java
    Replies: 2
    Last Post: 07-01-2007, 01:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts