Alright. So here's what I've currently got. Basically, I've got an array of numbers - any amount. My current code counts up the frequency of each number, then prints out the one that is the largest, and it works perfectly.
But the problem is, I need to make it be able to find multiple modes, and I have no idea on how I should try to do this. So here's a snippit of my current code:
int[] mode = new int[totalNumbers];
int totalmode = 0;
int tempmode = 0;
int occur = 0;
for (int i = 0; i < totalNumbers; i++)
{
tempmode = 0;
for (int k = 0; k < totalNumbers; k++)
{
if (arrays[i] == arrays[k])
{
tempmode = tempmode + 1;
if (totalmode < tempmode)
{
totalmode = tempmode;
occur = arrays[i];
}
}
}
}
Now. TotalNumbers is an int that is the size of the array. (Pretty much the same as using arrays.length)
So, I'm not asking you to code for me, as I'm pretty sure I can do it. I just need an idea of how I can actually do it, as I'm completely stumped. Thanks!