code: public static ByteBuffer allocateDirectWithNativeOrder(int capacity) {
          return ByteBuffer.allocateDirect(capacity).order(
                  PlatformDependent.BIG_ENDIAN_NATIVE_ORDER ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
      }
docs: Returns a new {@link ByteBuffer} which has the same {@link ByteOrder} as the native order of the machine.