Here you can find the source of toHtml(String txt)
public static String toHtml(String txt)
//package com.java2s; //License from project: Apache License public class Main { public static String toHtml(String txt) { return txt.replaceAll("\n", "<br>"); }//from w w w . j a v a 2 s . c o m }