Java Utililty Methods Hex to Unicode

List of utility methods to do Hex to Unicode

Description

The list of methods to do Hex to Unicode are organized into topic(s).

Method

StringconvertHexToUni(String theNumber)
convert Hex To Uni
char[] the_unicode_char = new char[1];
try {
    the_unicode_char[0] = (char) Integer.parseInt(theNumber, 16);
} catch (NumberFormatException nfe) {
    return null;
return new String(the_unicode_char);
StringConvertHexToUnicode(String hexCode)
Method to convert Hex representation to Unicode using Linear Scan
String toRet = "", nums = "";
boolean flag = false;
StringBuilder token = new StringBuilder();
char[] ch = hexCode.toCharArray();
for (int i = 0; i < ch.length; i++) {
    if (ch[i] == '&') {
        flag = true;
    if (flag) {
        token.append(ch[i]);
        if (ch[i] == ';') {
            nums = token.toString().substring(2, token.toString().indexOf(";"));
            try {
                toRet += (char) Integer.parseInt(nums);
            } catch (Exception e) {
                toRet += token;
            flag = false;
            token.setLength(0);
    } else {
        toRet += ch[i];
return toRet.trim();