tokenizing tab delimited text into 2D array
I'm trying to tokenize a tab delimited file into a 2 dimensional array, and I'm using the split method.
Each row of the file will insert its data into a new array row.
The array is statically defined as follows:
String[][] arr = new String [50][37];
Which will allow a total of 50 rows of data to be placed into the array.
I was originally using StringTokenizer to parse the file, until I realized that it doesn't return empty strings, which I need, because the first array row and any other array row need to have correspondence (e.g. arr[0][3] is a question string, arr[1][3] is the answer for that question in one row, arr[4][3] is the answer for that question in another row).
The original array returned from the split should have 36 elements, which should mean that element 37 (index 36) is null.However I want to statically define arr[0][36] to be a specific string, as it will always be used and will not change value.
Now my problem is that even though I have statically defined the array column to be 37 elements big, when printing out the array using a for loop, I get an ArrayIndexOutOfBoundsException when array index 36 is called. To test my problem, I did this:
String[] tempStr = new String[37];
System.out.println("tempStr length1: " + tempStr.length);
line = bfread.readLine();
tempStr = line.split("\u0009"); //tab char
System.out.println("tempStr length2: " + tempStr.length);
which outputs:
tempStr length1: 37
tempStr length2: 36
Can anyone help me out, or does anyone know why this is happening? I'd really appreciate some help -- I'm a Java newb, and this is really getting me frustrated.
Thanks!

