int (@NotNull CharSequence text, int pos, int length) { if (length > 1) { CharSequence s = text.subSequence(pos + 2, Math.min(text.length(), pos + length + 1)); try { return Integer.parseInt(s.toString(), 16); } catch (NumberFormatException e) { return '?'; } } else { final Integer result = ESC_TO_CODE.getValue().get(text.charAt(pos + 1)); return ObjectUtils.notNull(result, (int)text.charAt(pos + 1)); } }