private int toArray(IntBuffer buffer) {
        int remain = buffer.remaining();
        if (buffer.remaining() > 16) {
            throw new ArrayIndexOutOfBoundsException();
        }
        int pos = buffer.position();
        buffer.get(temp_array, 0, remain);
        buffer.position(pos);
        return remain;
    }
Implements OpenGL ES 2.0 and 3.0 for iOS. 

@author Kirill Vainer, Jesus Oliver
jme3-ios/src/main/java/com/jme3/renderer/ios/IosGL.java