You also haven't written your loops correctly. You appear to be having similar problems to somebody else whom I replied to about 5 minutes ago
here.
Right: using fixed numbers in
for loops is a bad idea; indeed if your array isn't a plain square
array matrix, using rows and columns variables can cause you to read the wrong lengths for your arrays. Remember it is much more serious to read too few values into the array than too many because you won't find out about the missing values until much later.
They ought to have taught you the basic format of a
for loop to iterate an array, because
1: Everybody is familiar with it2: If you don't change the indices inside the loop, this format always works.Here it is:-
for (int i = 0; i < myArray.length; i++) {...}
If you read into the array with such a loop without any changes to the indices, you will fill your array correctly. Remember yuor code is coupled tightly to the format of the text file. This coupling is very difficult to avoid.
* * * * * * * * * * * * * * * *
Also, haven't you been taught to close resources? Look at this
Java™ Tutorials section which tells you how to open a resource and close it without writing
close();
* * * * * * * * * * * * * * * *
Of course in the most very recent versions of Java® (“recent”? this feature is nearly seven years old) it has been possible to use a Stream to create arrays. Let's see if I can remember how to do it

The
Files#newBufferedReader() method takes a Path to the file (
Paths.get()) and creates a buffered reader to read it. Since you have read the Java™ Tutorials link I gave you, you will know what
try (...) means.
The
lines() method creates a Stream<
String> which handles the individual lines of the file. There is a brief introduction to Streams in the
Java™ Tutorials, but the best resources I know are Urma Fusco and Mycroft's books
Java8 in Action and
Modern Java in Action (Manning), which are actually different editions of the same book.
The
map() call converts the Stream of Strings to a
Stream<int[]>. It does this by passing each line to a
Scanner, which divides it into tokens using its default delimiter. The
tokens() call creates another Stream, which is converted to a special
Stream for ints with
mapToInt(), using the
Scanner#nextInt() method. The strange syntax with
:: is explained
here in the Java™ Tutorials (or in Urma Fusco and Mycroft). A closely related Java™ Tutorials
section explains the line with
->.
It should be obvious what the first
toArray() call does.
Now we have a Stream for
int[]s, which can be collected into an
int[][] with a different
toArray() method and the bit with
::new means it is passed the notional constructor of an
int[][].
Voilà!