title: Compare values in two files
body: <p>I have two files Which should contain the same values between Substring 0 and 10 though not in order. I have Managed to Outprint the values in each file but I need to Know how to Report say id the Value is in the first File and Notin the second file and vice versa. The files are in these formats.</p>
  
  <pre><code>6436346346....Other details
  9348734873....Other details
  9349839829....Other details
  </code></pre>
  
  <p>second file</p>
  
  <pre><code>8484545487....Other details
  9348734873....Other details
  9349839829....Other details
  </code></pre>
  
  <p>The first record in the first file does not appear in the second file and the first record in the second file does not appear in the first file. I need to be able to report this mismatch in this format:</p>
  
  <pre><code>Record 6436346346 is in the firstfile and not in the secondfile.
  Record 8484545487 is in the secondfile and not in the firstfile.
  </code></pre>
  
  <p>Here is the code I currently have that gives me the required Output from the two files to compare.</p>
  
  <pre><code>package compare.numbers;
  
  import java.io.*;
  
  /**
   *
   * @author implvcb
   */
   public class CompareNumbers {
  
  /**
   * @param args the command line arguments
   */
   public static void main(String[] args) {
      // TODO code application logic here
      File f = new File("C:/Analysis/");
      String line;
      String line1;
      try {
          String firstfile = "C:/Analysis/RL001.TXT";
          FileInputStream fs = new FileInputStream(firstfile);
          BufferedReader br = new BufferedReader(new InputStreamReader(fs));
          while ((line = br.readLine()) != null) {
              String account = line.substring(0, 10);
               System.out.println(account);
  
  
          }
          String secondfile = "C:/Analysis/RL003.TXT";
          FileInputStream fs1 = new FileInputStream(secondfile);
          BufferedReader br1 = new BufferedReader(new InputStreamReader(fs1));
          while ((line1 = br1.readLine()) != null) {
              String account1 = line1.substring(0, 10);
              System.out.println(account1);
          }
  
      } catch (Exception e) {
          e.fillInStackTrace();
      }
  
  
  
  }
  }
  </code></pre>
  
  <p>Please help on how I can effectively achieve this.
  I think I needed to say that am new to java and may not grab the ideas that easily but Am trying.</p>