title: Java array min and max issue
body: <pre><code>package array;
  import java.util.*;
  public class Array {
  
  public static void main(String[] args) {
       int [] a = new int [10];
       Random number = new Random ();
       int x;
        int min, max ;
        min = max = a[0];
  
  for (int b = 0; b&lt;a.length; b++)
     {
         x = number.nextInt (100);
        // System.out.println (x); just for testing x
  
        a [b]= x;
         System.out.println (a[b]);
  
         if (a[b] &lt; min) min = a[b];
         if (a[b] &gt; max) max = a[b];
     }
  
   System.out.println ("Min is: " + min + " " + "Max is: "+ max );
  }
  }
  </code></pre>
  
  <p>When i set <strong>min = a[0];</strong> and <strong>max = a[0]</strong>, it only returns max value and min is always 0; Can not figure whats wrong. But when I assign values for a[0]..a[9] it works. Can someone help me please? </p>