I don't know what a csv file is or what the structure is, but if its just a text a file with numbers like that, it's quite simple.
The only thing to be careful about in this code is that it assumes there won't be more than 24 elements, or tokens, in each line of text.
String[24][24] numbers;
File file = new File("something.csv");
BufferedReader bufRdr = new BufferedReader(new FileReader(file));
String line = null;
int row = 0;
int col = 0;
//read each line of text file
while((line = bufRdr.readLine()) != null)
{
StringTokenizer st = new StringTokenizer(line,",");
while (st.hasMoreTokens())
{
//get next token and store it in the array
numbers[row][col] = st.nextToken();
col++;
}
row++;
}
//close the file
bufRdr.close(); Phaelax
Practically a Posting Shark
858 posts since Mar 2004
Reputation Points: 92
Solved Threads: 51