nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/compression/CompressionDescriptor.java
public ByteBuffer toByteBuffer() {
        //2 ints  at 4 bytes a piece, this includes the compression algorithm
        //that we convert to enum
        int enumSize = 2 * 4;
        //4 longs at 8 bytes a piece
        int sizesLength = 4 * 8;
        ByteBuffer directAlloc = ByteBuffer.allocateDirect(enumSize + sizesLength).order(ByteOrder.nativeOrder());
        directAlloc.putInt(compressionType.ordinal());
        directAlloc.putInt(CompressionAlgorithm.valueOf(compressionAlgorithm).ordinal());
        directAlloc.putLong(originalLength);
        directAlloc.putLong(compressedLength);
        directAlloc.putLong(numberOfElements);
        directAlloc.putLong(originalElementSize);
        directAlloc.rewind();
        return directAlloc;
    }
public ByteBuffer toByteBuffer() {
        //2 ints  at 4 bytes a piece, this includes the compression algorithm
        //that we convert to enum
        int enumSize = 2 * 4;
        //4 longs at 8 bytes a piece
        int sizesLength = 4 * 8;
        ByteBuffer directAlloc = ByteBuffer.allocateDirect(enumSize + sizesLength).order(ByteOrder.nativeOrder());
        directAlloc.putInt(compressionType.ordinal());
        directAlloc.putInt(CompressionAlgorithm.valueOf(compressionAlgorithm).ordinal());
        directAlloc.putLong(originalLength);
        directAlloc.putLong(compressedLength);
        directAlloc.putLong(numberOfElements);
        directAlloc.putLong(originalElementSize);
        directAlloc.rewind();
        return directAlloc;
    }
public ByteBuffer toByteBuffer ( ) { //2 ints  at 4 bytes a piece, this includes the compression algorithm //that we convert to enum int enumSize = 2 * 4 ; //4 longs at 8 bytes a piece int sizesLength = 4 * 8 ; ByteBuffer directAlloc = ByteBuffer . allocateDirect ( enumSize + sizesLength ) . order ( ByteOrder . nativeOrder ( ) ) ; directAlloc . putInt ( compressionType . ordinal ( ) ) ; directAlloc . putInt ( CompressionAlgorithm . valueOf ( compressionAlgorithm ) . ordinal ( ) ) ; directAlloc . putLong ( originalLength ) ; directAlloc . putLong ( compressedLength ) ; directAlloc . putLong ( numberOfElements ) ; directAlloc . putLong ( originalElementSize ) ; directAlloc . rewind ( ) ; return directAlloc ; }
Return a direct allocated
bytebuffer from the compression codec.
The size of the bytebuffer is calculated to be:
40: 8 + 32
two ints representing their enum values
for the compression algorithm and opType

and 4 longs for the compressed and
original sizes
@return the bytebuffer described above
Return a direct allocated bytebuffer from the compression codec . The size of the bytebuffer is calculated to be : 40 : 8 + 32 two ints representing their enum values for the compression algorithm and opType