public static String pad(int n){
  StringBuilder b=new StringBuilder(40);
  String p="0";
  if (n < 0) {
    p="-";
    n=Integer.MAX_VALUE + n + 1;
  }
  b.append(p);
  String s=Integer.toString(n);
  for (int i=s.length(); i <= intLength; i++) {
    b.append("0");
  }
  b.append(s);
  return b.toString();
}

public static String pad ( int n ) { StringBuilder b = new StringBuilder ( 40 ) ; String p = "0" ; if ( n < 0 ) { p = "-" ; n = Integer . MAX_VALUE + n + 1 ; } b . append ( p ) ; String s = Integer . toString ( n ) ; for ( int i = s . length ( ) ; i <= intLength ; i ++ ) { b . append ( "0" ) ; } b . append ( s ) ; return b . toString ( ) ; }
a simple padding function that should work with any int
