I need a function or method to find the number of values that repeat in one value. I am not looking for the numbers that repeat, or how many times they repeat, but simply the quantity of numbers that repeat in general. That may sound confusing so here is an example:
int[] anArray = {
1, 2, 3,
4, 3, 1,
7, 2, 9, 1
};
The number 1 has multiple instances, so does 2 and 3.
Therefore my output should be "There are 3 cases of consecutive values"
This is what I have so far:
int x;
int i = 0;
int[] array = new int[10];
do {
x = input.nextInt();
array[i] = x;
i++;
} while(x!=0);
Outside of the loop I need to be able to output the number of repeating values. This is while loop practice, and therefore I am not allowed to use for loops.
forloop, you could easily convert it to awhileloop.