Hi everyone im a bit confused with my work and i hope you can help me. i need to get some values from a text file and enter it into a 2D array ive done this part ok with the following code however in my file i have some other text which is just normal string and i dont want this to be in be in the array so before the numbers ive done [Set 1] and at the end of the numbers [End Set 1] is it possible to for me to get the text inbetween these two points. everytime i try something it seems to mess up the return map part can any one help me please.
public static int[][] Map(File f) throws IOException {
ArrayList line = new ArrayList();
BufferedReader br = new BufferedReader(new FileReader(f));
String s = null;
while ((s = br.readLine()) != null)
line.add(s);
int[][] map = new int[line.size()][];
for (int i = 0; i < map.length; i++) {
s = (String) line.get(i);
StringTokenizer st = new StringTokenizer(s, " ");
int[] arr = new int[st.countTokens()];
for (int j = 0; j < arr.length; j++)
arr[j] = Integer.parseInt(st.nextToken());
map[i] = arr;
}
return map;
}