public static void loadFile() { File f = new File("sudoku.txt"); int row =0; //Load the file try { s = new Scanner(f); } catch (FileNotFoundException e) { System.out.println("File not found"); } //Read the file, line by line into the 2D Array while(s.hasNext()) { String line = s.nextLine(); for(int col =0; col < line.length(); col++) { board[row][col]= (int) (line.charAt(col)-48); } row++; } s.close(); }