public static long doubleToSortableLong ( double value ) { long bits = Double . doubleToLongBits ( value ) ; return bits ^ ( bits >> 63 ) & Long . MAX_VALUE ; }
Converts a double value to a sortable long . The value is converted by getting their IEEE 754 floating - point bit layout . Some bits are swapped to be able to compare the result as long .