I am new to coding and I am wondering how I can make sure a specific array contains certain values?
This is what I have but it is not working for me. I have tried searing the internet for a solution but I am confused by a lot of them. Any feedback helps!
public static boolean allnumbers(int[] arr) {// makes sure only numbers 1-9 are used
boolean[] found = new boolean[9]; // creates a boolean array
for (int row = 0; row > 1 && row > 9; row++) {
int index = arr[row] - 1;
if(!found[index]) {
found[index] = true;
} else{
return false; //returns false if there are numbers that are not between 1-9
}
}
return true;
}