static char decodeEntity(String source){
  if (source.length() < 4 || source.charAt(0) != HTML_ENTITY_START || source.charAt(source.length() - 1) != HTML_ENTITY_TERMINATE) {
    return HTML_ENTITY_INVALID;
  }
  if (source.charAt(1) == HTML_ENTITY_RAWVALUE) {
    try {
      if (Character.toLowerCase(source.charAt(2)) == HTML_ENTITY_RAWHEXVALUE) {
        return (char)Integer.parseInt(source.substring(3,4),16);
      }
 else {
        return (char)Integer.parseInt(source.substring(2,3),10);
      }
    }
 catch (    NumberFormatException nfe) {
      return HTML_ENTITY_INVALID;
    }
  }
  source=source.toLowerCase();
  for (int i=0; i < HTML_ENCODED_ENTITIES.length; i++) {
    if (source.equals(HTML_ENCODED_ENTITIES[i])) {
      return HTML_ENTITIES[i];
    }
  }
  return HTML_ENTITY_INVALID;
}

static char decodeEntity ( String source ) { if ( source . length ( ) < 4 || source . charAt ( 0 ) != HTML_ENTITY_START || source . charAt ( source . length ( ) - 1 ) != HTML_ENTITY_TERMINATE ) { return HTML_ENTITY_INVALID ; } if ( source . charAt ( 1 ) == HTML_ENTITY_RAWVALUE ) { try { if ( Character . toLowerCase ( source . charAt ( 2 ) ) == HTML_ENTITY_RAWHEXVALUE ) { return ( char ) Integer . parseInt ( source . substring ( 3 , 4 ) , 16 ) ; } else { return ( char ) Integer . parseInt ( source . substring ( 2 , 3 ) , 10 ) ; } } catch ( NumberFormatException nfe ) { return HTML_ENTITY_INVALID ; } } source = source . toLowerCase ( ) ; for ( int i = 0 ; i < HTML_ENCODED_ENTITIES . length ; i ++ ) { if ( source . equals ( HTML_ENCODED_ENTITIES [ i ] ) ) { return HTML_ENTITIES [ i ] ; } } return HTML_ENTITY_INVALID ; }
decode an html encoded entity .
