question: static private void _writeDecRef ( Writer out , char ch ) throws IOException { if ( ch == '€' ) { out . write ( "&euro;" ) ; return ; } out . write ( "&#" ) ; int i = ( int ) ch ; if ( i > 10000 ) { out . write ( '0' + ( i / 10000 ) ) ; i = i % 10000 ; out . write ( '0' + ( i / 1000 ) ) ; i = i % 1000 ; out . write ( '0' + ( i / 100 ) ) ; i = i % 100 ; out . write ( '0' + ( i / 10 ) ) ; i = i % 10 ; out . write ( '0' + i ) ; } else if ( i > 1000 ) { out . write ( '0' + ( i / 1000 ) ) ; i = i % 1000 ; out . write ( '0' + ( i / 100 ) ) ; i = i % 100 ; out . write ( '0' + ( i / 10 ) ) ; i = i % 10 ; out . write ( '0' + i ) ; } else { out . write ( '0' + ( i / 100 ) ) ; i = i % 100 ; out . write ( '0' + ( i / 10 ) ) ; i = i % 10 ; out . write ( '0' + i ) ; } out . write ( ';' ) ; }
target:  Writes a character as a decimal escape.  Hex escapes are smaller than the decimal version, but Netscape didn't support hex escapes until 4.7.4.