Hey, I have a statistics class with this method in it. The purpose of this method is to find the mode of my array that I made in the driver class. It creates an array with 100 slots in it and each slot is a random number from 0-99. I tried to make another array with 100 slots as using that in a for loop to count the number of times each number is being used but it returns a 0 for me every time. Any help is appreciated thanks!
Also my original array is called 'stats'.
public int mode() { int mode=0; int Number[]=new int[100]; for(int i=0;i<Number.length;i++){ Number[i]=0;} for (int i=0;i<Number.length;i++){ for (int i2=0;i2<Number.length;i2++){ if(Number[i]==i2) Number[i2]++;}} for (int Mode=0;Mode<Number.length;mode++){ if (mode<Number[mode]) mode=Number[mode];} return mode;}
Also my original array is called 'stats'.