code: static public int unpackInt(ByteBuffer bb)
        throws IOException {
      for (int offset = 0, result = 0; offset < 32; offset += 7) {
        int b = bb.get() & 0xffff;
        result |= (b & 0x7F) << offset;
        if ((b & 0x80) == 0) {
          return result;
        }
      }
      throw new Error("Malformed integer.");
    }
docs: Unpack positive int value from the input byte buffer.
  
  @param bb The byte buffer
  @return the long value
  @throws IOException if an error occurs with the stream