public static String encode(String encode){
  StringBuilder str=new StringBuilder(encode);
  String key;
  int i=0;
  while (i < str.length()) {
    key=findValue(str.charAt(i));
    if (key != null) {
      str.replace(i,i + 1,key);
      i+=key.length();
    }
 else {
      i++;
    }
  }
  return str.toString();
}

public static String encode ( String encode ) { StringBuilder str = new StringBuilder ( encode ) ; String key ; int i = 0 ; while ( i < str . length ( ) ) { key = findValue ( str . charAt ( i ) ) ; if ( key != null ) { str . replace ( i , i + 1 , key ) ; i += key . length ( ) ; } else { i ++ ; } } return str . toString ( ) ; }
converts special characters in ascii into html entities ( e . g . & - > & amp ; )
