May 16

The Double class contains two methods that return a representation of a floating point value according to the IEEE 754 floating-point “double format” bit layout.

The first, doubleToLongBits() does not preserve NaN and returns it as 0x7ff8000000000000L.

The second, doubleToRawLongBits() does preserve NaN and returns the representation of the actual NaN value.

The long returned by these methods can then be converted to a byte array.

byte[] array = longToByteArray(Double.doubleToRawLongBits(doubleValue));

written by objects \\ tags: , , ,

Leave a Reply

You must be logged in to post a comment.