public static void appendZeroPadded(StringBuilder buff,int length,long positiveValue){
  if (length == 2) {
    if (positiveValue < 10) {
      buff.append('0');
    }
    buff.append(positiveValue);
  }
 else {
    String s=Long.toString(positiveValue);
    length-=s.length();
    while (length > 0) {
      buff.append('0');
      length--;
    }
    buff.append(s);
  }
}

public static void appendZeroPadded ( StringBuilder buff , int length , long positiveValue ) { if ( length == 2 ) { if ( positiveValue < 10 ) { buff . append ( '0' ) ; } buff . append ( positiveValue ) ; } else { String s = Long . toString ( positiveValue ) ; length -= s . length ( ) ; while ( length > 0 ) { buff . append ( '0' ) ; length -- ; } buff . append ( s ) ; } }
append a zero - padded number to a string builder .
