public static int putCompressedInt(OutputStream out, final int value) throws IOException {
    int i = 0;
    int tmpvalue = value;
    do {
      byte b = (byte) (tmpvalue & VALUE_MASK);
      tmpvalue >>>= NEXT_BIT_SHIFT;
      if (tmpvalue != 0) {
        b |= (byte) NEXT_BIT_MASK;
      }
      out.write(b);
      i++;
    } while (tmpvalue != 0);
    return i;
  }
Put in buffer integer using 7 bit encoding. For each written byte: 7 bits are used to store
value 1 bit is used to indicate whether there is next bit.
@param value Int to be compressed.
@param out   Where to put compressed data
@return Number of bytes written.
@throws IOException on stream error
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java