public static int sizeOfVarint(int value) {
        return sizeOfUnsignedVarint((value << 1) ^ (value >> 31));
    }
Number of bytes needed to encode an integer in variable-length format.

@param value The signed value
clients/src/main/java/org/apache/kafka/common/utils/ByteUtils.java