title: Calculate average in java
body: <p><strong>EDIT: I've written code for the average but I don't know how to make it so that it also uses <code>int</code>s from my <code>args.length</code> rather than the array.</strong></p>
  <p>I need to write a java program that can calculate:</p>
  <ol>
  <li>the number of integers read in</li>
  <li>the average value – which need not be an integer!</li>
  </ol>
  <p>NOTE: I don't want to calculate the average from the array but the integers in the <code>args</code>.</p>
  <p>Currently I have written this:</p>
  <pre><code>int count = 0;
  for (int i = 0; i&lt;args.length -1; ++i)
      count++;
      System.out.println(count);
  }
      
  int nums[] = new int[] { 23, 1, 5, 78, 22, 4};
  double result = 0; //average will have decimal point
  for(int i=0; i &lt; nums.length; i++){
      result += nums[i];
  }
  System.out.println(result/count)
  </code></pre>
  <p>Can anyone guide me in the right direction? Or give an example that guides me in the right way to shape this code?</p>
  <p>Thanks in advance.</p>