I have inputed 20 numbers in the range 0 to 100 in one array by name num. Then i have another array by name output with 10 elements all initialized to zero; I have to go through the list of intput numbers and increment one of the elements in output based on what range the number resides.

Given any input number in the range [0, 99], i need an expression or a method that determines which elemnt in output to increment? For example, if number is 22, it should increment output[2]. Here is my code with first part working, second part is to display a histogram that shows how many numbers are in the range 0 to 9, 10 to 19 etc.,

import java.awt.*;
import java.applet.*;


public class ArrayTest extends Applet

{
private int [] num = {5, 7, 8, 19, 25, 30, 37, 41, 43, 50, 52, 55,
61, 63, 70, 76, 84, 91, 95, 98};
private int [] output = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};


private int max, min, sum;
private float average;

public void largestSmallest()
{

max = -1;
min = 101;

for (int i = 0; i < num.length; i++)
{
if (max < num[i])
{
max = num[i];
}
if (min > num[i])
{
min = num[i];
}
}

}

public void sumAverage()
{
sum = 0;
average = 0.0f;

for (int i = 0; i < num.length; i++)
{
sum = sum + num[i];
average = (float)(sum) / num.length;
}

}

public void paint (Graphics g)
{
largestSmallest();
sumAverage();

g.drawString("The largest number in this array is: " + max, 30, 50);
g.drawString("The smallest number in this array is: " + min, 30, 80);
g.drawString("The sum of the numbers in this array is: " + sum, 30, 110);
g.drawString("The mean of the numbers in this array is: " + average, 30, 140);



}

}
Being newly introduced to arrays, I am having problems not knowing how to increment the second array based on the input from first array.
Any Help appreciated..
Kt