Reading IEEE float values from files.
FileInputSream, BufferedInputStream
FileReader, BufferedReader
These classes AFAIK only have read methods which return strings, char arrays or byte arrays, or single bytes. The problem is if I want to read 2 byte floats or 4 byte double precision IEEE floating point numbers, how do I read them and use them in java?? I really don't to read these byte by byte and have to do manual binary number manipulation and reading.
Thanks for reading! Thanks for helpful comments in advance!
Re: Reading IEEE float values from files.
Read them into a string then use
Code :
double myDouble = Double.valueOf(theString);
Regards,
Chris
Re: Reading IEEE float values from files.
I tried this but it only seems to read the number as the ascii representation not the actual value, ie. it reads 0x3132 as 12 from the ascii character for 0x31 for 2 and the ascii character for 0x32 is 2, but what I need is the actual number (IEEE integer) as in 0x3132 is 12849.
Re: Reading IEEE float values from files.
Nvm I found the answer, DataInputStream lets you read all data types including unsigned values. Except I still don't know how to handle big-endian little-endianess.