String (int keyCode) { if (keyCode >= VK_0 && keyCode <= VK_9 || keyCode >= VK_A && keyCode <= VK_Z) { return String.valueOf((char)keyCode); } String knownKeyCode = ourKeyCodes.get(keyCode); if (knownKeyCode != null) return knownKeyCode; if (keyCode >= VK_NUMPAD0 && keyCode <= VK_NUMPAD9) { char c = (char)(keyCode - VK_NUMPAD0 + '0'); return "NumPad-" + c; } if ((keyCode & 0x01000000) != 0) { return String.valueOf((char)(keyCode ^ 0x01000000)); } return "Unknown keyCode: 0x" + Integer.toString(keyCode, 16); }