Java how to add int in an array using loop
<p>i cant seem to figure out the logic, here's my code</p>

<pre><code>class stringrays {
public static void main (String[] args) {

    int[] numrays = {23, 6, 47, 35, 2, 14};
    int i;
    int z;
    int y;

    for (i=1; i &lt; numrays.length; i++) {
        z = numrays[0] + numrays[i];
        System.out.println(z);
    }
}
</code></pre>

<p>the above results shows 
29
70
58
25
37</p>

<p>which means that array 0 adds array 1, then array 0 adds array array 2 and so on.</p>

<p>what i want, is to add the first array 0 onto the next array and so on.. using a loop condition.</p>

<p>then get the average of the sum.</p>
