I have a text file. It is designed as follows:
# 1 {1,12,345,867}
# 2 {123, 3243534, 2132131231}
# 3 {234, 35345}
#4{}
... (at the end of each entry is "\ n")
That's an example. Actually my lines #number {number, number, ..., number} can be very long ...
Here is the class constructor template that works with this file:
public Submatrix(String matrixFilePath, int startPos, int endPos) throws FileNotFoundException{
}
As you can see, the submatrix is determined by the startPos and endPos numbers of the matrix rows.
My question is: "How could I count the rows to achieve the right one?" My file can contain billions of lines. Should I use LineNumberReader-> readLine () billions of times ?????
source
share