5
0
-1,0
1,-1,0
-1,1,-1,0
-1,-1,-1,1,0
I have to ignore the 5 and the put the 0,1,and -1's in a 2D array.
Here is what I have tried and still can't get it.
FileInputStream fstream = new FileInputStream("map5.txt"); Scanner scan = new Scanner(fstream); DataInputStream In = new DataInputStream(fstream); BufferedReader reader = new BufferedReader(new InputStreamReader(In)); String line; while ((line = reader.readLine()) != null) { StringTokenizer line2 = new StringTokenizer(line, ","); while (line2.hasMoreTokens()) { int temp; temp = Integer.parseInt(line2.nextToken()); map[col][row] = temp; col++; row++; } }