int (int start) { if (buffer.charAt(start) == '#') { char hex = buffer.charAt(start); try { if (hex == 'x' || hex == 'X') { return Integer.valueOf(buffer.substring(start + 2), 16); } return Integer.parseInt(buffer.substring(start + 1)); } catch (NumberFormatException nfe) { return -1; } } return HtmlEntities.getEntityValue(buffer.substring(start)); }