title: Java array lowest number and average not computing correctly
body: <p>I am new to java. I have an assignment that requires the following:
  Develop a program which allows the user to enter numbers into an array.  Input will be as follows:</p>
  
  <p>The user will enter the total number of integers to be entered into the array.</p>
  
  <p>The user will then enter that number of unique integers (negative or positive).  Do not allow the number of values entered to exceed the array size.</p>
  
  <p>Develop methods to:</p>
  
  <p>Sort the array</p>
  
  <p>Determine the highest value</p>
  
  <p>Determine the lowest value</p>
  
  <p>Calculate the average value (double)</p>
  
  <p>The code below does run but it displays the lowest number I enter as 0, which is not correct and the average does display in a double format but it always rounds the number (3.0 instead of 3.3). Can someone please let me know what I am doing wrong and how can I fix this. I have been googling the problem for 3 days now and can't find out where I went wrong.</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.Arrays;
  
  public class UserArray2 {
  
      public static void main(String[] args) {
  
          Scanner input = new Scanner(System.in);
  
          //allow user  input;
          System.out.println("How many numbers do you want to enter?");
          int num = input.nextInt();
  
          int numbers[] = new int[num];        
          int low = numbers[0];
          int max = numbers[0];
          int sum = 0;
          double avgNum;
  
          System.out.println("Enter the " + num + " numbers now.");
  
          for (int i = 0 ; i &lt; numbers.length; i++ ) {
             numbers[i] = input.nextInt();
          }
  
  
          //sort
          System.out.println("The numbers you entered have been sorted from lowest to greatest:");
          Arrays.sort( numbers );
          for ( int i = 0 ; i &lt; numbers.length ; i++ ) {
  
              System.out.println(numbers[i]);
          }
  
          //max
  
          for (int counter = 1; counter &lt; numbers.length; counter++)
          {
           if (numbers[counter] &gt; max)
           {
            max = numbers[counter];
           } 
  
           }
  
          //lowest
  
          for (int counter = 1; counter &lt; numbers.length; counter++)
          {
           if (numbers[counter] &lt; low)
           {
            low = numbers[counter];
           } 
  
           }
  
          //average
          for (int i : numbers)
          sum += i;
          avgNum = sum/numbers.length;
  
  
          System.out.println("The largest number on your list is: " + max);
          System.out.println("The lowest number on your list is: " + low);
          System.out.println("The average of the list of numbers is: " + avgNum);
      }
  
  
      public static void printArray(int arr[]){
  
          int n = arr.length;
  
          for (int i = 0; i &lt; n; i++) {
              System.out.print(arr[i] + " ");
          }
      }
  
  }
  </code></pre>