Finding the Mode in An Array

Hi. My instructor gave us an assignment to calculate the modes in an array. Basically, the array values (not the index) contains the frequencies of the index number (like a histogram). For example, since the value of "10" (the highest number for values) occurs in index numbers 2, 4, and 11, the program must output that the "mode occurs at index numbers 2, 4, and 11." Here's what I have so far:

Code:

`public class Stats`

{

public static void main(String[]args)

{

int[] array = new int [16];

array[0] = 0;

array[1] = 0;

array[2] = 10;

array[3] = 5;

array[4] = 10;

array[5] = 0;

array[6] = 7;

array[7] = 1;

array[8] = 0;

array[9] = 6;

array[10] = 0;

array[11] = 10;

array[12] = 3;

array[13] = 0;

array[14] = 0;

array[15] = 1;

System.out.println("The maximum is " + CalculateMaximum(array) + ".");

}

public static int CalculateMaximum(int[] array)

{

int maximum = array[0];

for (int i = 1; i < array.length; i++)

{

if ( array[i] > maximum)

{

maximum = array[i];

}

}

return maximum;

}

}

So far, I've managed to calculate the maximum (the program outputs 10). My problem is, I can't think of an algorithm that will return the index numbers if the array value is its maximum. That is... what can I do so that whenever the program sees that the maximum number (the mode) is 10, that it returns the index value of the array?

That was confusing. Let me know if you need clarification. Thanks