Problem with reading numbers from file into double int array...
Okay, this is a snippet of my code:
publicvoid readMap(String file){
try{
URL url = getClass().getResource(file);
System.out.println(url.getPath());
BufferedReader in =new BufferedReader(new FileReader(url.getPath()));
String str;
String[] temp;
int j=0;
while ((str = in.readLine()) !=null){
temp = str.split(",");
for(int i=0;i<temp.length;i++){
map[j][i] = java.lang.Integer.parseInt(temp[i]);
}
j++
}
in.close();
}catch (IOException e){
System.out.println("Error: "+ e.toString());
}
}
map[][] is a double int array. Now, the code is running through each line of the text file (with each line looking like this: 0,3,6,2,2,3,1,5,2,3,5,2), and I want to put the numbers into a corresponding double int array (which is where map[][] comes in). Now, this code WOULD work, except I need to set the sizes of each array before I start adding, but I don't know how to get the exact sizes.. how can I get around this issue?
Message was edited by:
maxfarrar>

