code: private void writeLengthToStream(int length, OutputStream out) throws IOException {
      sharedByteBuffer.clear();
      sharedByteBuffer.order(ByteOrder.BIG_ENDIAN).putInt(length);
      sharedByteBuffer.flip();
      out.write(sharedByteBuffer.array(), 0, Ints.BYTES);
      sharedByteBuffer.order(byteOrder);
    }
docs: Write Length in Big Endian Order as per GDAT format specification.