question: public static void appendPaddedInteger ( StringBuffer buf , int value , int size ) { if ( value < 0 ) { buf . append ( '-' ) ; if ( value != Integer . MIN_VALUE ) { value = - value ; } else { for ( ; size > 10 ; size -- ) { buf . append ( '0' ) ; } buf . append ( "" + - ( long ) Integer . MIN_VALUE ) ; return ; } } if ( value < 10 ) { for ( ; size > 1 ; size -- ) { buf . append ( '0' ) ; } buf . append ( ( char ) ( value + '0' ) ) ; } else if ( value < 100 ) { for ( ; size > 2 ; size -- ) { buf . append ( '0' ) ; } int d = ( ( value + 1 ) * 13421772 ) > > 27 ; buf . append ( ( char ) ( d + '0' ) ) ; buf . append ( ( char ) ( value - ( d << 3 ) - ( d << 1 ) + '0' ) ) ; } else { int digits ; if ( value < 1000 ) { digits = 3 ; } else if ( value < 10000 ) { digits = 4 ; } else { digits = ( int ) ( Math . log ( value ) / LOG_10 ) + 1 ; } for ( ; size > digits ; size -- ) { buf . append ( '0' ) ; } buf . append ( Integer . toString ( value ) ) ; } }
target:  Converts an integer to a string, prepended with a variable amount of '0' pad characters, and appends it to the given buffer. <p>This method is optimized for converting small values to strings.