what i would do would be to have a header kinda that represents how many things following it will be in the first dimension, and after that have a second header for the second dimension and read lines instead of tokens kinda like
DataInputStream reader = new DataInputStream(...);
header = reader.readInt();
while(header > 0)
array[...][array.length-header-1]= reader.readInt();//or whatever your reading
is that what you were looking for? otherwise your gonna have to explain what you want a lil better
either way your gonna have to nest loops somehow