long getAddress(final Buffer buffer) {

        if (buffer instanceof ByteBuffer) {
            return MemoryUtil.memAddress((ByteBuffer) buffer, 0);
        } else if (buffer instanceof ShortBuffer) {
            return MemoryUtil.memAddress((ShortBuffer) buffer, 0);
        } else if (buffer instanceof CharBuffer) {
            return MemoryUtil.memAddress((CharBuffer) buffer, 0);
        } else if (buffer instanceof IntBuffer) {
            return MemoryUtil.memAddress((IntBuffer) buffer, 0);
        } else if (buffer instanceof FloatBuffer) {
            return MemoryUtil.memAddress((FloatBuffer) buffer, 0);
        } else if (buffer instanceof LongBuffer) {
            return MemoryUtil.memAddress((LongBuffer) buffer, 0);
        } else if (buffer instanceof DoubleBuffer) {
            return MemoryUtil.memAddress((DoubleBuffer) buffer, 0);
        }

        return -1;
    }
Get memory address of the buffer.

@param buffer the buffer.
@return the address or -1.
jme3-lwjgl3/src/main/java/com/jme3/util/LWJGLBufferAllocator.java