title: what is the best way to write these java arrays?
body: <p>I am stuck on my class work:</p>
  <blockquote>
  <p>Create an application containing an array that stores eight integers. The application should</p>
  <ol>
  <li>display all the integers, (done)</li>
  <li>display all the integers in reverse order,</li>
  <li>display the sum of the eight integers, (done)</li>
  <li>display all values less than 5,</li>
  <li>display the lowest value, (done)</li>
  <li>display the highest value, (done)</li>
  <li>calculate and display the average, (Done)</li>
  <li>display all values that are higher than the calculated average value.</li>
  </ol>
  </blockquote>
  <p>I must use (or attempt to use) an array; also must use at least one loop to &quot;traverse&quot; (move through) the array. This also due @ 23:59 mountain standard time tonight</p>
  <p>What am I doing wrong?</p>
  <pre><code>package numberlistdemo;
  
  import java.util.Arrays;
  
  public class NumberListDemo 
  {
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) 
      {
               int n[]= {1,2,3,4,5,6,7,8};
      int lowest = 1000;
      int highest = 0;
      int sum = 0;
      int five = 0;
      int OverF = 0;
      int rev = 0;
      int OverAve= 0;
      
          for (int i=0;i&lt;n.length;i++)
             
          {
              
              int cur = n[i];
              if (cur &lt; lowest) lowest = cur;
              if (cur &gt; highest) highest = cur;
               sum += cur;
              
          }
           double ave = sum / n.length;
           
           for (int i=0;i&lt;n.length;i++)
           {
              int cur = n[i];
              if (cur &gt; ave) OverAve = cur;
           }
           
         for (int i=0;i&lt;n.length;i++)
         {
            
             int LowF = n[i];
             if (LowF &lt; 5) five = LowF;
             if (LowF &gt; 5) OverF  = LowF;
         }
         
          
          
              //3
              System.out.println(&quot;Total of the Array is &quot; + sum );
              //1
              System.out.println(&quot;The number we are using are &quot; + Arrays.toString(n));
              //4
              System.out.println(&quot;All values lower the 5 are &quot; + five );
              ////2
               for (int counter=n.length - 1; counter &gt;= 0; counter--)
          {
             System.out.println(&quot;The reverse order of the numbers are &quot; + (n[counter]));
          }         
               //5
              System.out.println(&quot;The lowest value is &quot; + lowest);
              //6
              System.out.println(&quot;The highest value is &quot;+ highest);
              //7
              System.out.println(&quot;The average is &quot; + ave);     
              //8
              System.out.println(&quot;All numbers higher than the average are: &quot; + OverAve);
             
    
      }
  }
  </code></pre>
  <p>I get this</p>
  <pre><code>Total of the Array is 36
  The number we are using are [1, 2, 3, 4, 5, 6, 7, 8]
  All values lower the 5 are 4
  The reverse order of the numbers are 8
  The reverse order of the numbers are 7
  The reverse order of the numbers are 6
  The reverse order of the numbers are 5
  The reverse order of the numbers are 4
  The reverse order of the numbers are 3
  The reverse order of the numbers are 2
  The reverse order of the numbers are 1
  The lowest value is 1
  The highest value is 8
  The average is 4.0
  All numbers higher than the average are: 8
  </code></pre>