static long getLong(byte[] memory, int index) {
        return ((long) memory[index] & 0xff) << 56 | ((long) memory[index + 1] & 0xff) << 48
               | ((long) memory[index + 2] & 0xff) << 40 | ((long) memory[index + 3] & 0xff) << 32
               | ((long) memory[index + 4] & 0xff) << 24 | ((long) memory[index + 5] & 0xff) << 16
               | ((long) memory[index + 6] & 0xff) << 8 | (long) memory[index + 7] & 0xff;
    }
Utility class for heap buffers.

Forked from <a href="https://github.com/netty/netty">Netty</a>.
jraft-core/src/main/java/com/alipay/sofa/jraft/util/HeapByteBufUtil.java