public static long readAsVLong(final byte[] buffer, final int offset) {
    byte firstByte = buffer[offset];
    int len = WritableUtils.decodeVIntSize(firstByte);
    if (len == 1) {
      return firstByte;
    }
    long i = 0;
    for (int idx = 0; idx < len - 1; idx++) {
      byte b = buffer[offset + 1 + idx];
      i = i << 8;
      i = i | (b & 0xFF);
    }
    return (WritableUtils.isNegativeVInt(firstByte) ? ~i : i);
  }
Reads a zero-compressed encoded long from input buffer and returns it.
@param buffer Binary array
@param offset Offset into array at which vint begins.
@return deserialized long from buffer.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java