public static void appendUnpaddedInteger(StringBuffer buf,int value){
  if (value < 0) {
    buf.append('-');
    if (value != Integer.MIN_VALUE) {
      value=-value;
    }
 else {
      buf.append("" + -(long)Integer.MIN_VALUE);
      return;
    }
  }
  if (value < 10) {
    buf.append((char)(value + '0'));
  }
 else   if (value < 100) {
    int d=((value + 1) * 13421772) >> 27;
    buf.append((char)(d + '0'));
    buf.append((char)(value - (d << 3) - (d << 1) + '0'));
  }
 else {
    buf.append(Integer.toString(value));
  }
}

public static void appendUnpaddedInteger ( StringBuffer buf , int value ) { if ( value < 0 ) { buf . append ( '-' ) ; if ( value != Integer . MIN_VALUE ) { value = - value ; } else { buf . append ( "" + - ( long ) Integer . MIN_VALUE ) ; return ; } } if ( value < 10 ) { buf . append ( ( char ) ( value + '0' ) ) ; } else if ( value < 100 ) { int d = ( ( value + 1 ) * 13421772 ) > > 27 ; buf . append ( ( char ) ( d + '0' ) ) ; buf . append ( ( char ) ( value - ( d << 3 ) - ( d << 1 ) + '0' ) ) ; } else { buf . append ( Integer . toString ( value ) ) ; } }
converts an integer to a string , and appends it to the given buffer . < p > this method is optimized for converting small values to strings .
