private static long roundUpToPowerOfTwo(long i) {
        if (i <= 0) {
            return 0;
        } else if (i > (1L << 62)) {
            throw new ArithmeticException("There are no 63-bit powers of 2 higher than " +
                    "or equal to " + i);
        } else {
            return 1L << -Long.numberOfLeadingZeros(i - 1);
        }
    }
Calculate the capacity we should provision, given the expected size.
<br>
Our capacity must always be a power of 2, and never less than 2 or more
than MAX_CAPACITY.  We use 64-bit numbers here to avoid overflow
concerns.
server-common/src/main/java/org/apache/kafka/timeline/BaseHashTable.java