how to find out whether certain elements in an array are equal to one another?
for this array: int array[] = {0, 1, 0, 0, 2, 0, 0, 3, 0, 1};
i wanna know if elements under the indexes 0, 1, and 9 are same numbers
well the easy way is:
if(array[0] == array[1] && array[1]==array[9])
{
System.out.println("These are same elements!");
}
or something like this, for testing only once
but the thing is, i want to test different set of elements in the array by looping.
any ideas? :?:
thank you :)