Here you can find the source of toHTMLEncode(String string)
public static String toHTMLEncode(String string)
//package com.java2s; //License from project: Apache License public class Main { /***********************************************************************/ public static String toHTMLEncode(String string) { if (string == null) { return null; }//from www . j a v a2 s. c o m string = string.replaceAll("<", "<"); string = string.replaceAll("\n", "<br />"); return string; } }