class Main {
public static final String HEX_DIGITS = "0123456789ABCDEF";
public static char decodeUTF8(String src) {
if (src == null) {
throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
}
if (!(src.startsWith("\\u") && src.length() <= 6)) {
throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
}
char[] sources = src.substring(2).toCharArray();
char res = 0;
for (char nextChar : sources) {
int digit = HEX_DIGITS.indexOf(Character.toUpperCase(nextChar));
res = (char) (res * 16 + digit);
}
return res;
}
}