public static String htmlAngleBrackets(String str){
  str=str.replaceAll("<","&lt;");
  str=str.replaceAll(">","&gt;");
  return str;
}

public static String htmlAngleBrackets ( String str ) { str = str . replaceAll ( "<" , "&lt;" ) ; str = str . replaceAll ( ">" , "&gt;" ) ; return str ; }
replace & lt ; & gt ; characters with & amp ; lt ; & amp ; gt ; entities .
