I/O in
Java is a little complicated, for sure

... but once you're used to playing with Streams and Writers, you can do powerful stuff relatively easily.
DataInputStream reads data in platform-independent binary format. That is, for an int it reads four bytes, and stores those directly as the value of the int to which you read.
Rather than this, you want to a human-readable integer. The easiest way to do this is with two steps:
1. Read the
String value of the integer from the file.
2. Convert the String version to an integer.
The easiest way to read a String from a file is with a BufferedReader attached (ultimately) to a FileInputStream, like this:
Then, use the readLine() method to get the String containing "322".
Second, to convert to int, you can use the Integer.parseInt method.
Hope this helps.
Cheers,
--Tim
[ April 19, 2004: Message edited by: Tim West ]
[ April 19, 2004: Message edited by: Tim West ]