title: I want to Copy the Largest number from one file to another File?But, I cannot find the largest Number
body: <p>I tried to take the data taken from a file, convert it to a character array, find the largest number from file first.txt and copy the result to file second.txt. However, when I compile and run the program the following problems occur:</p>
  
  <ol>
  <li>Does not take two digit Arrays.</li>
  <li>It also does not take more than 5 numbers from the text file</li>
  <li>Whenever I compile the program it writes the last number in the second file.</li>
  </ol>
  
  <p>This is the code I am working with.</p>
  
  <pre><code>BufferedReader out = new BufferedReader(new  FileReader("first.txt"));
  PrintWriter in = new PrintWriter(new FileWriter("second.txt"));
  char[] array = null;
  String str = " ";
  str = out.readLine();
  array = str.toCharArray();
  char max = array[0];
  
  for (char c : array) {
      if(c &gt; max);
      max = c;
      in.write(max);
  </code></pre>