public static int toUpperCaseOfCodeForLocale( final int code, final boolean needsToUpperCase, final Locale locale) { if (!KeyboardConstants.isLetterCode(code) || !needsToUpperCase) return code; final String text = new String(new int[] {code}, 0, 1); final String casedText = KeySpecParser.toUpperCaseOfStringForLocale(text, needsToUpperCase, locale); return StringUtils.codePointCount(casedText) == 1 ? casedText.codePointAt(0) : CODE_UNSPECIFIED; }