I need help with my code. I need it to return true showing the list contains duplicates. As it sits now, it always returns false.
Code:
public static boolean hasDuplicates(int[] values)
{
int[] numbers = values;
boolean found = false;
int value = 0;
for (int i = 0; i < numbers.length; i++){
if(value == numbers[i]){
found = true;
}
value = numbers[i];
}
return found;
}