Java 2 array min max avg?
<p>How do I create a loop to generate min, max, avg for 2 array lists, i have only generated the min, max and avg with sum for single array lists so far.</p>

<p>These are the 2 arrays User[] &amp; Withdrawals[]:</p>

<pre><code>User, Withdrawals
1 , 90.00
2 , 85.00
4 , 75.00
5 , 65.00
2 , 40.00
1 , 80.00
3 , 50.00
5 , 85.00
4 , 80.00
1 , 70.00

size = 10
</code></pre>

<p>This is what i have tried, as i have no clue about 2 arrays interdependent:</p>

<pre><code>double min = 0.0;
double max = 0.0;
double sum = 0.0;
double avg = 0.0;

for(int i = 0; i &lt;size; i++){
.
.
for(int j = 0; j &lt; Withdrawals.length; j++){
   if(Withdrawals[User[i]] &gt; max){  
      max = Withdrawals[j];  
   }  
   if(Withdrawals[User[i]] &lt; min){  
      min = Withdrawals[j];  
   }
}  
sum += Withdrawals[j];
avg = sum/size;
}
</code></pre>

<p>how do i print the min, max, avg from the no of withdrawals per user ? :S</p>

<p>I have already counted the number of withdrawals per user.</p>

<p>Conditions are: create everything from scratch instead of using available library features of Java.</p>
