Can someone please tell me how i can convert a Hex string to its corresponding single precision or double precision floating point number according to the IEEE-754 format in java?
For example : "4682E989" and "A4703D4A0B0B7441"
BR suppi
Returns the double value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double format" bit layout.
You can get a long
from the hex representation with Long.parseLong
new BigInteger(s, 16).longValue()
(as Peter Lawrey points out). Long.parseLong
won't do because it fails on numbers larger than 2^63-1.