Maze application and 2D arrays

I'm in the middle of making a java application that solves a 2D maze obtained from a text file, the text file contains x's for walls and white space as space. I want to read the characters into a 2d arrays (rows and columns), so that if the maze is 40x30 then it reads the first 40 into an array for row etc etc and so on for all 30 lines but I have absolutely no idea when it comes to 2D arrays, can anybody help me here?

[431 byte] By [wickedprayer] at [2007-9-30 23:20:18]
# 1

i've tried using just an array containing every character and a different method, this is what i've got so far if you can make any sense of it:

File fileName = new File(args[0]);

FileInputStream fis = new FileInputStream(fileName);

BufferedInputStream bis = new BufferedInputStream(fis);

DataInputStream dis = new DataInputStream(bis);

BufferedReader reader = new BufferedReader(new FileReader(fileName));

char[] characters = new char[mazeArea];

int count = reader.read(characters);

reader.close();

count = 0;

while (count < mazeArea) {

System.out.print(characters[count]);

count++;

}

but i just don't know what to do when it comes to 2D arrays, i have tried using some other stuff but i didn't keep the code, made a mess of what i'd done with it... if any one can offer any help (or directions to a good tutorial website) i'd be very grateful, thanks.

wickedprayer at 2007-7-7 13:53:11 > top of Java-index,Administration Tools,Sun Connection...
# 2

oh and i have also tried using:

try {

while ((record=dis.readLine()) != null) {

recordCount++;

System.out.println(record);

}

}

catch (IOException errorMessage) {

System.out.println("IOEXCEPTION ERROR: " + errorMessage.getMessage());

}

finally {

if (dis != null) {

try {

dis.close();

}

catch (IOException ioe) {

}

}

}

would it be possible to store all that into a single string and then break it up or something?

wickedprayer at 2007-7-7 13:53:11 > top of Java-index,Administration Tools,Sun Connection...
# 3

oh and i have also tried using:

try {

while ((record=dis.readLine()) != null) {

recordCount++;

System.out.println(record);

}

}

catch (IOException errorMessage) {

System.out.println("IOEXCEPTION ERROR: " + errorMessage.getMessage());

}

finally {

if (dis != null) {

try {

dis.close();

}

catch (IOException ioe) {

}

}

}

would it be possible to store all that into a single string and then break it up or something?

wickedprayer at 2007-7-7 13:53:11 > top of Java-index,Administration Tools,Sun Connection...