code: public long getByteBufferAddress(ByteBuffer byteBuffer) {
          /*
           * This only works for DIRECT byte buffers. Direct ByteBuffers have a field
           * called "address" which
           * holds the physical address of the start of the buffer contents in native
           * memory.
           * This method obtains the value of the address field through reflection.
           */
          if (!byteBuffer.isDirect()) {
              throw new IllegalArgumentException("The specified byte buffer is not direct");
          }
          try {
              return svAddrField.getLong(byteBuffer);
          } catch (IllegalAccessException exception) {
              throw new RuntimeException(exception.getMessage());
          }
      }
docs: Get the native address for the specified DirectByteBuffer
  
  @param byteBuffer
  Reference to a DirectByteBuffer
  
  @return The native address of the specified DirectByteBuffer
  
  @throws IllegalArgumentException
  If the specified buffer is not direct