Alex Rivera | Logout

Converting 8 bytes of little-endian binary into a double precision float

Asked 2011-06-24T16:58:55.070
12

I have a binary file that I read byte by byte.

I come across a section that is 8 bytes long, holding a double precision float (little endian). I can't figure out how to read this in and calculate it properly with masking and/or casting.

(To be specific, the file type is .LAS, but that shouldn't matter).

Are there any Java tricks?

Edit
Report

1 Answer

1

If you need to read and swap byte order, there is EndianUtils from Commons IO:

https://commons.apache.org/proper/commons-io/javadocs/api-2.5/org/apache/commons/io/EndianUtils.html

answered 2011-06-24T17:05:43.380

Your Answer