title: Can't find five lowest values in an array...max works while min array is not assigned values
body: <p>I'm very close to completing this, all I need is help on finding the five lowest values from a text file by using arrays. I figured out how to find the five highest values, but my min array to find the lowest values always outputs five 0's.</p>
  
  <p>Output: //obviously dependent on individual text file</p>
  
  <p>Total amount of numbers in text file is 10</p>
  
  <p>Sum is: 1832</p>
  
  <p>1775 14 9 9 7 //max </p>
  
  <p>0 0 0 0 0 //min</p>
  
  <p>Any help is much appreciated!</p>
  
  <pre><code>import java.util.Scanner; 
  import java.io.*;
  
  public class HW3
  {
     public static void main(String[] args) throws IOException
     {
    File f = new File("integers.txt");
    Scanner fr = new Scanner(f);
  
      int sum = 0;
      int count = 0;
      int[] max = new int[5];
      int[] min = new int[5];
      int temp;
  
    while(fr.hasNextInt())
    {
          count++;        
          fr.nextInt();
    }
  
      Scanner fr2 = new Scanner(new File("integers.txt"));
      int numbers[] = new int[count];
  
      for(int i=0;i&lt;count;i++)
    {
      numbers[i]=fr2.nextInt(); //fills array with the integers
    }
  
      for(int j:numbers)//get sum
      {
          sum+=j;
      }
  
      for (int j=0; j &lt; 5; j++) //finds five highest
      {
          for (int i=0; i &lt; numbers.length; i++)
              {
                  if (numbers[i] &gt; max[j])
                  {
                      temp = numbers[i];
                      numbers[i] = max[j];
                      max[j] = temp;
                  }
              }   
      }
  
      for (int j=0; j &lt; 5; j++) //finds five lowest...array not assigned values
      {
          for (int i=0; i &lt; numbers.length; i++)
              {
                  if (numbers[i] &lt; min[j])
                  {
                      temp = numbers[i];
                      numbers[i] = min[j];
                      min[j] = temp;
                  }
              }   
      }
  
      System.out.println("Total amount of numbers in text file is " + count);
      System.out.println("Sum is: " + sum);
      System.out.println(max[0] + " " + max[1] + " " + max[2] + " " + max[3] + " " + max[4]);
      System.out.println(min[0] + " " + min[1] + " " + min[2] + " " + min[3] + " " + min[4]);
  
     }
  }
  </code></pre>