public static long nextPowerOf2(long num) {
        final long highBit = Long.highestOneBit(num);
        return (highBit == num) ? num : highBit << 1;
    }
Returns the next number greater or equal num that is power of 2.
indexr-query-opt/src/main/java/org/apache/spark/memory/MemoryManager.java