public static long prefixCodedToLong(final BytesRef val){
  long sortableBits=0L;
  for (int i=val.offset + 1, limit=val.offset + val.length; i < limit; i++) {
    sortableBits<<=7;
    final byte b=val.bytes[i];
    if (b < 0) {
      throw new NumberFormatException("Invalid prefixCoded numerical value representation (byte " + Integer.toHexString(b & 0xff) + " at position "+ (i - val.offset)+ " is invalid)");
    }
    sortableBits|=b;
  }
  return (sortableBits << getPrefixCodedLongShift(val)) ^ 0x8000000000000000L;
}

public static long prefixCodedToLong ( final BytesRef val ) { long sortableBits = 0L ; for ( int i = val . offset + 1 , limit = val . offset + val . length ; i < limit ; i ++ ) { sortableBits <<= 7 ; final byte b = val . bytes [ i ] ; if ( b < 0 ) { throw new NumberFormatException ( "Invalid prefixCoded numerical value representation (byte " + Integer . toHexString ( b & 0xff ) + " at position " + ( i - val . offset ) + " is invalid)" ) ; } sortableBits |= b ; } return ( sortableBits << getPrefixCodedLongShift ( val ) ) ^ 0x8000000000000000L ; }
returns a long from prefixcoded bytes . rightmost bits will be zero for lower precision codes . this method can be used to decode a term ' s value .
