public static long readVarlong(InputStream in) throws IOException {
        long value = 0L;
        int i = 0;
        long b;
        while (((b = in.read()) & 0x80) != 0) {
            value |= (b & 0x7f) << i;
            i += 7;
            if (i > 63)
                throw illegalVarlongException(value);
        }
        value |= b << i;
        return (value >>> 1) ^ -(value & 1);
    }
Read a long stored in variable-length format using zig-zag decoding from
<a href="http://code.google.com/apis/protocolbuffers/docs/encoding.html"> Google Protocol Buffers</a>.

@param in The input to read from
@return The long value read

@throws IllegalArgumentException if variable-length value does not terminate after 10 bytes have been read
@throws IOException              if {@link DataInput} throws {@link IOException}
clients/src/main/java/org/apache/kafka/common/utils/ByteUtils.java