the code is supposed to play tictactoe, but theres an exception in the print game board method, out of bounds exception, and i cant figure out why. if anyone knows how to avoid that exception i would appreciate advice. this is what i have so far:

```
 static char arrayList[][] = {{0,1,2},{0,1,2}};
 static Scanner input;
 public static void main(String[] args) {
 // Only one scanner!!!
 input = new Scanner(System.in);
 while (true) { // TTT 4 forever!
 printGameBoard();
 userInput();
 if (checkForWin('X')) {
 System.out.println("Congrats, you won!");
 break;
 }
 if (checkForStale()) {
 printGameBoard();
 System.out.println("Tie!");
 break;
 }
 computerTurn();
 if (checkForWin('O')) {
 System.out.println("All hail the future overlords!");
 break;
 }
 if (checkForStale()) {
 System.out.println("Tie!");
 break;
 }
 }
 }
 static void printGameBoard() {
 System.out.println("+---+---+---+");
 System.out.println("| " + arrayList[0][0] + " | " + arrayList[0][1] + " | " + arrayList[0][2]
 + " |");
 System.out.println("+---+---+---+");
 System.out.println("| " + arrayList[1][0] + " | " + arrayList[1][1] + " | " + arrayList[1][2]
 + " |");
 System.out.println("+---+---+---+");
 System.out.println("| " + arrayList[2][0] + " | " + arrayList[2][1] + " | " + arrayList[2][2]
 + " |");
 System.out.println("+---+---+---+");
 }
 static void userInput() {
 System.out.print("Please enter the board number:");
 int place = input.nextInt();
// Note to self: check user input for sanity here!
 if (checkForSanity(place)) {
 placeOnBoard(place, 'X');
 System.out.println("Ok...");
 printGameBoard();
 } else {
 System.out.println("Wrong move!");
 }
 }
 static void computerTurn() {
 boolean placed = false;
 while (!placed) {
 // Randomly choose a place
 int place = (int) (1 + (Math.random() * 8));
 // Check if sane
 if (checkForSanity(place)) {
 placeOnBoard(place, 'O');
 placed = true;
 }
 }
 printGameBoard();
 }
 static boolean checkForWin(char piece) {
 if ((arrayList[0][0] == piece) && (arrayList[0][1] == piece) && (arrayList[0][2] == piece))
 return true;
 if ((arrayList[1][0] == piece) && (arrayList[1][1] == piece) && (arrayList[1][2] == piece))
 return true;
 if ((arrayList[2][0] == piece) && (arrayList[2][1] == piece) && (arrayList[2][2] == piece))
 return true;
 if ((arrayList[0][0] == piece) && (arrayList[1][0] == piece) && (arrayList[2][0] == piece))
 return true;
 if ((arrayList[0][1] == piece) && (arrayList[1][1] == piece) && (arrayList[2][1] == piece))
 return true;
 if ((arrayList[0][2] == piece) && (arrayList[1][2] == piece) && (arrayList[2][2] == piece))
 return true;
 if ((arrayList[0][0] == piece) && (arrayList[1][1] == piece) && (arrayList[2][2] == piece))
 return true;
 if ((arrayList[0][2] == piece) && (arrayList[1][1] == piece) && (arrayList[2][0] == piece))
 return true;
 return false;
 }
 static boolean checkForStale() {
 if ((arrayList[0][0] != ' ') && (arrayList[0][1] != ' ') && (arrayList[0][2] != ' ')
 && (arrayList[1][0] != ' ') && (arrayList[1][1] != ' ') && (arrayList[1][2] != ' ')
 && (arrayList[2][0] != ' ') && (arrayList[2][1] != ' ') && (arrayList[2][2] != ' '))
 return true;
 return false;
 }
 static void placeOnBoard(int place, char piece) {
 if (place == 1)
 arrayList[0][0] = piece;
 else if (place == 2)
 arrayList[0][1] = piece;
 else if (place == 3)
 arrayList[0][2] = piece;
 else if (place == 4)
 arrayList[1][0] = piece;
 else if (place == 5)
 arrayList[1][1] = piece;
 else if (place == 6)
 arrayList[1][2] = piece;
 else if (place == 7)
 arrayList[2][0] = piece;
 else if (place == 8)
 arrayList[2][1] = piece;
 else if (place == 9)
 arrayList[2][2] = piece;
 }
 static boolean checkForSanity(int place) {
 boolean sane = false;
 if ((place == 1) && (arrayList[0][0] == ' '))
 sane = true;
 else if ((place == 2) && (arrayList[0][1] == ' '))
 sane = true;
 else if ((place == 3) && (arrayList[0][2] == ' '))
 sane = true;
 else if ((place == 4) && (arrayList[1][0] == ' '))
 sane = true;
 else if ((place == 5) && (arrayList[1][1] == ' '))
 sane = true;
 else if ((place == 6) && (arrayList[1][2] == ' '))
 sane = true;
 else if ((place == 7) && (arrayList[2][0] == ' '))
 sane = true;
 else if ((place == 8) && (arrayList[2][1] == ' '))
 sane = true;
 else if ((place == 9) && (arrayList[2][2] == ' '))
 sane = true;
 return sane;
 }
 static boolean checkForSanity(int row, int col) {
 return true;
 }
}

```

`