Here you can find the source of escapeHTML(String source)
public static final String escapeHTML(String source)
//package com.java2s; import java.util.*; public class Main { private static HashMap<String, String> s_reverseHtmlEntities; /**// ww w . ja v a 2 s . co m * Convert a regular string to a string with escaped * HTML entities (e.g. < changes to < ) */ public static final String escapeHTML(String source) { StringBuilder ret = new StringBuilder(); String val = null; int idx = 0; for (idx = 0; idx < source.length(); idx++) { val = s_reverseHtmlEntities.get(source.substring(idx, idx + 1)); if (val == null) { ret.append(source.charAt(idx)); } else { ret.append(val); } } return ret.toString(); } }