public static final StringBuilder sprintf0d(StringBuilder sb,int value,int width){
  long d=value;
  if (d < 0) {
    sb.append('-');
    d=-d;
    --width;
  }
  int n=10;
  for (int i=2; i < width; i++) {
    n*=10;
  }
  for (int i=1; i < width && d < n; i++) {
    sb.append('0');
    n/=10;
  }
  sb.append(d);
  return sb;
}

public static final StringBuilder sprintf0d ( StringBuilder sb , int value , int width ) { long d = value ; if ( d < 0 ) { sb . append ( '-' ) ; d = - d ; -- width ; } int n = 10 ; for ( int i = 2 ; i < width ; i ++ ) { n *= 10 ; } for ( int i = 1 ; i < width && d < n ; i ++ ) { sb . append ( '0' ) ; n /= 10 ; } sb . append ( d ) ; return sb ; }
mimics sprintf ( buf , " % 0 * d " , decaimal , width ) .
