public static int encodeDesc ( Long value , byte [ ] dst , int dstOffset ) { if ( value == null ) { dst [ dstOffset ] = NULL_BYTE_LOW ; return 1 ; } else { dst [ dstOffset ] = NOT_NULL_BYTE_LOW ; DataEncoder . encode ( ~ value . longValue ( ) , dst , dstOffset + 1 ) ; return 9 ; } }
Encodes the given signed Long object into exactly 1 or 9 bytes for descending order . If the Long object is never expected to be null consider encoding as a long primitive .