private static int appendHex(int i, final StringBuilder stringBuilder, final String string) throws ImagingException {
        if (i + 2 >= string.length()) {
            throw new ImagingException("Parsing XPM file failed, " + "hex constant in string too short");
        }
        final char hex1 = string.charAt(i + 1);
        final char hex2 = string.charAt(i + 2);
        i += 2;
        final int constant;
        try {
            constant = Integer.parseInt(hex1 + Character.toString(hex2), 16);
        } catch (final NumberFormatException nfe) {
            throw new ImagingException("Parsing XPM file failed, " + "hex constant invalid", nfe);
        }
        stringBuilder.append((char) constant);
        return i;
    }
Parses the hexadecimal-base escape-sequence found at index {@code i} of {@code string}.

<p>
Helper-function for {@code unescapeString()}.
</p>

@param i             the index of the escape-sequence in the string
@param stringBuilder the stringBuilder to append the escape-char to
@param string        the string whose chars are parsed
@return the new index i
@since 1.0-alpha3
src/main/java/org/apache/commons/imaging/common/BasicCParser.java