Here you can find the source of HTMLBREncode(String str)
public static String HTMLBREncode(String str)
//package com.java2s; //License from project: GNU General Public License public class Main { public static String HTMLBREncode(String str) { return str.replaceAll("\r\n", "\r\n<br class=\"br\"/>\r\n"); }//from w ww . j av a2 s. c o m }