0

I'm working on a constructor which lets the player input a starting sudoku grid and also checks if it's valid and can be played, ie, it doesn't already have duplicate numbers. The code listed here is my newest attempt and works on making each number +1 to another array. So game*[j] = 1, so checkarray[(game [j])-2))] ++*

then I check to see that checkArray all has 1s, otherwise, it probably ain't valid. This or some form of it will also be used for columm, 3x3 square checking. But it's not working and keeps on throwing the illegalargumentexception and I honestly can't figure out why. So help please?

```
public Sudoku(int[][] game) //constructor to allow player-inputted starting sudoku grid and see if it's valid
{
for (int i=0; i<9; i++){
int[] checkarray = {0, 0, 0, 0, 0, 0, 0, 0, 0};
for (int j=0; j<9; j++){
checkarray[((game[i][j])+1)] = checkarray[((game[i][j])+1)] + 1;
}
for (int k=0; k<9; k++){
if (checkarray[k] != 1){
throw new IllegalArgumentException("error");
}
}
}
}
```