Here you can find the source of HTMLEscapeBr(String original)
public static String HTMLEscapeBr(String original)
//package com.java2s; //License from project: Open Source License public class Main { public static String HTMLEscapeBr(String original) { if (original == null) return ""; StringBuffer out = new StringBuffer(""); char[] chars = original.toCharArray(); for (int i = 0; i < chars.length; i++) { boolean found = true; switch (chars[i]) { case '\n': out.append("<br/>"); break; //newline case '\r': break; default: found = false;/*w ww.j av a 2s . c om*/ break; } if (!found) out.append(chars[i]); } return out.toString(); } }