public static String unescapeHTML(String str){
  StringBuilder rtn=new StringBuilder();
  int posStart=-1;
  int posFinish=-1;
  while ((posStart=str.indexOf('&',posStart)) != -1) {
    int last=posFinish + 1;
    posFinish=str.indexOf(';',posStart);
    if (posFinish == -1)     break;
    rtn.append(str.substring(last,posStart));
    if (posStart + 1 < posFinish) {
      rtn.append(unescapeHTMLEntity(str.substring(posStart + 1,posFinish)));
    }
 else {
      rtn.append("&;");
    }
    posStart=posFinish + 1;
  }
  rtn.append(str.substring(posFinish + 1));
  return rtn.toString();
}

public static String unescapeHTML ( String str ) { StringBuilder rtn = new StringBuilder ( ) ; int posStart = - 1 ; int posFinish = - 1 ; while ( ( posStart = str . indexOf ( '&' , posStart ) ) != - 1 ) { int last = posFinish + 1 ; posFinish = str . indexOf ( ';' , posStart ) ; if ( posFinish == - 1 ) break ; rtn . append ( str . substring ( last , posStart ) ) ; if ( posStart + 1 < posFinish ) { rtn . append ( unescapeHTMLEntity ( str . substring ( posStart + 1 , posFinish ) ) ) ; } else { rtn . append ( "&;" ) ; } posStart = posFinish + 1 ; } rtn . append ( str . substring ( posFinish + 1 ) ) ; return rtn . toString ( ) ; }
unescapes html character inside a string
