if ( activations == chars.length ) { char[] newChars = new char[activations + 3]; System.arraycopy( chars, 0, newChars, 0, activations ); this.chars = chars = newChars; int[] newKeyCodes = new int[activations + 3]; System.arraycopy( this.keyCodes, 0, newKeyCodes, 0, activations ); this.keyCodes = newKeyCodes; boolean[] newPressed = new boolean[activations + 3]; System.arraycopy( this.pressed, 0, newPressed, 0, activations ); this.pressed = newPressed;
if ( pressed || !allowRepeats ) { if ( activations == chars.length ) { char[] newChars = new char[activations + 3]; System.arraycopy( chars, 0, newChars, 0, activations ); this.chars = chars = newChars; int[] newKeyCodes = new int[activations + 3]; System.arraycopy( this.keyCodes, 0, newKeyCodes, 0, activations ); this.keyCodes = newKeyCodes; boolean[] newPressed = new boolean[activations + 3]; System.arraycopy( this.pressed, 0, newPressed, 0, activations ); this.pressed = newPressed; } chars[activations] = character; keyCodes[activations] = buttonIndex;
        public synchronized void checkActivation( char character, int buttonIndex, float position, float delta, boolean pressed, Object data ) {            if ( buttonIndex == this.keyCode || this.keyCode == InputHandler.BUTTON_ALL ) {                int activations = this.activations;                char[] chars = this.chars;                if ( activations == chars.length ) {                    char[] newChars = new char[activations + 3]; // allocate 3 at a time                    System.arraycopy( chars, 0, newChars, 0, activations );                    this.chars = chars = newChars;                    int[] newKeyCodes = new int[activations + 3];                    System.arraycopy( this.keyCodes, 0, newKeyCodes, 0, activations );                    this.keyCodes = newKeyCodes;                    boolean[] newPressed = new boolean[activations + 3];                    System.arraycopy( this.pressed, 0, newPressed, 0, activations );                    this.pressed = newPressed;                }                chars[activations] = character;                keyCodes[activations] = buttonIndex;                if ( allowRepeats ) {                    if ( pressed ) {                        this.pressed[activations] = true;                        activate();                        this.activations = activations + 1;                    }                    else {                        if ( activations == 0 ) {                            deactivate();                        }                    }                } else {                    this.pressed[activations] = pressed;                    activate();                    this.activations = activations + 1;                }            }        }