I am reading a txt file and trying to save it into a 2-dimensional(2D) array, but got the error,the .txt file is saved definitely as a 100*997 array splitted by \t. It says
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 924!
int i=0;
double[][] vector=new double[100][997];
String line;
while ((line=br.readLine()) != null) {
line=line.trim();
String[] words = line.split("\t");
for (int j=0; j<997; j++) {
vector[i][j] = Double.parseDouble(words[j]);
}
i++;
}
Why is it out of bounds at 924?
Thank you very much!