public static long bytesToVint(final byte[] buffer) {
    int offset = 0;
    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++];
      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 buffer to convert
@return vint bytes as an integer.
hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java