Reading numbers from file

I have a text file that contains numbers & characters stored iin a particluar format something like this

200410010800

6

1 180 200410080000 1 ()

2 90 200410010900 5 ()

3 180 200410081700 2 ()

4 600 200410081700 1 ()

5 360 200410081700 2 (3,4)

6 10000 200410081600 4 ()

if i use datainput stream to read numbers the numbers i get are different from one's in the file

for eg

the 1st line is 200410010800 when i use readLong what i get is 3616443501500182577

can someone tell me why this happens and how i can get the proper values?

[612 byte] By [balakumar] at [2007-9-30 20:03:29]
# 1

What is the format of the file? You need to read it in a manner that matches the contents.

If the data is in plain text, then it should be read as a string.

If it's formatted as Unicode characters, it should be read as Java characters.

If it's formatted as, say, a java integer (4 bytes) then it should be read as one.

The data above looks like it's just text, since all of it consists of printable ASCII characters.

ChuckBing at 2007-7-7 0:49:50 > top of Java-index,Administration Tools,Sun Connection...
# 2
yes it is from text filei need to read the numbers that are separated by whitespace.and put in an array the numbers in the braces.
balakumar at 2007-7-7 0:49:50 > top of Java-index,Administration Tools,Sun Connection...
# 3
well, im pretty sure readInt() reads the next 32 bits of the file and readLong() reads the next 64 bits
Mythicwolf at 2007-7-7 0:49:50 > top of Java-index,Administration Tools,Sun Connection...
# 4

> yes it is from text file

> i need to read the numbers that are separated by

> whitespace.

> and put in an array the numbers in the braces.

Since it is a character file, use a Reader to read it, most likely a FileReader. Use a BufferedReader with the FileReader to read in lines of text as a String. Then use either a StringTokenizer or the String.split() method to break up your String.

atmguy at 2007-7-7 0:49:50 > top of Java-index,Administration Tools,Sun Connection...