double to long without conversion in Java

2019-02-17 08:31发布

问题:

I need to turn double into long preserving its binary structure, not number value. Just change type, but leave binary value as it is. Is there a native way to do it?

回答1:

There is Double with to doubleToLongBits and doubleToLongRawBits. Javadoc is your friend.