public static long readVarLong(ByteBuffer buff){
  long x=buff.get();
  if (x >= 0) {
    return x;
  }
  x&=0x7f;
  for (int s=7; s < 64; s+=7) {
    long b=buff.get();
    x|=(b & 0x7f) << s;
    if (b >= 0) {
      break;
    }
  }
  return x;
}

public static long readVarLong ( ByteBuffer buff ) { long x = buff . get ( ) ; if ( x >= 0 ) { return x ; } x &= 0x7f ; for ( int s = 7 ; s < 64 ; s += 7 ) { long b = buff . get ( ) ; x |= ( b & 0x7f ) << s ; if ( b >= 0 ) { break ; } } return x ; }
read a variable size long .
