I'm trying read matrix n by n which is stored in txt file. First line of the file specifying size of matrix :
My file look like :
5
1 2 3 4 5
2 3 4 6 8
5 6 8 7 4
4 9 9 9 9
4 4 7 8 2
Here is code snippet where what I've try is :
bufferedReader.readLine();
for (int m = 0; m < size; m++) {
String[] st = br.readLine().trim().split(" ");
System.out.println(st);
for (int n = 0;n < size; n++) {
inputArray[m][n] = Integer.parseInt(st[n]);
}
}
but I get output like this after printing inputArray :
inputArray is :
1
1
1
1
1
please can anyone point what possibilities that I've missing. what is possible bug in this approach.