I have a pretty generic question about arrays. It is for a dice rolling game I have to make for homework.
I have an array of length 7 that contains ints that are the result of my various dice rolling methods and I need to find out if the array contains multiple instances of an element, what that element is, and how many times it occurs. Being new to Java, I don't even know where to look for a method that does this sort of thing. Does anyone know where I can find one, or better yet have tips on how to write one myself?
One of the hardest parts for me conceptually is that I don't know how many results I will have, as there could be up to two pairs and a trio. IE int[] roll = { 3, 3, 4, 4, 5, 5, 5 }. I think the best way to get around it would be to use a loop until my multiple finding method fails, each time removing the matching elements.
Thanks a lot for any help, this is due at midnight!