code: public static void doByteBufferPutCompressed(INDArray arr, ByteBuffer allocated, boolean rewind) {
          CompressedDataBuffer compressedDataBuffer = (CompressedDataBuffer) arr.data();
          CompressionDescriptor descriptor = compressedDataBuffer.getCompressionDescriptor();
          ByteBuffer codecByteBuffer = descriptor.toByteBuffer();
          ByteBuffer buffer = arr.data().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
          ByteBuffer shapeBuffer = arr.shapeInfoDataBuffer().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
          allocated.putInt(arr.rank());
          //put data opType next so its self describing
          allocated.putInt(arr.data().dataType().ordinal());
          //put shape next
          allocated.put(shapeBuffer);
          //put codec information next
          allocated.put(codecByteBuffer);
          //finally put the data
          allocated.put(buffer);
          if (rewind)
              allocated.rewind();
      }
docs: Setup the given byte buffer
  for serialization (note that this is for compressed INDArrays)
  4 bytes for rank
  4 bytes for data opType
  shape information
  codec information
  data opType
  
  @param arr the array to setup
  @param allocated the byte buffer to setup
  @param rewind whether to rewind the byte buffer or not