Well one thing is that your
cursor
variable holds the entire contents of the file (more or less), and you iterate over the
sudokuArray
using the length of
cursor
as an indexer, and the array is only 9x9 in size;
int[][] sudokuArray = new int[9][9];
...
for (int i = 0; i < cursor.length(); i++) {
char character = cursor.charAt(i);
String value = Character.toString(character);
int add = Integer.parseInt(value);
sudokuArray[position][i] = add;
}
Try printing the exception message instead of "Something bad happened", the exception message will tell you what that bad thing was.
Hope this helps,
Fredrik