question: private static String unicode2html ( final String text , final boolean amp , final boolean html ) { if ( text == null ) return null ; final StringBuilder sb = new StringBuilder ( text . length ( ) * 12 / 10 ) ; int textpos = 0 ; String r ; char c ; while ( textpos < text . length ( ) ) { c = text . charAt ( textpos ) ; if ( amp && c == AMP_UNICODE ) { sb . append ( AMP_HTML ) ; textpos ++ ; continue ; } if ( ( r = UNICODE2HTML4XML . get ( c ) ) != null ) { sb . append ( r ) ; textpos ++ ; continue ; } if ( html && ( r = UNICODE2HTML4HTML . get ( c ) ) != null ) { sb . append ( r ) ; textpos ++ ; continue ; } sb . append ( c ) ; textpos ++ ; } return sb . toString ( ) ; }
target:  Replaces characters which have special representation in HTML or XML.