public static String leftPad(String s,int minLength,char filling){
  int ln=s.length();
  if (minLength <= ln) {
    return s;
  }
  StringBuilder res=new StringBuilder(minLength);
  int dif=minLength - ln;
  for (int i=0; i < dif; i++) {
    res.append(filling);
  }
  res.append(s);
  return res.toString();
}

public static String leftPad ( String s , int minLength , char filling ) { int ln = s . length ( ) ; if ( minLength <= ln ) { return s ; } StringBuilder res = new StringBuilder ( minLength ) ; int dif = minLength - ln ; for ( int i = 0 ; i < dif ; i ++ ) { res . append ( filling ) ; } res . append ( s ) ; return res . toString ( ) ; }
pads the string at the left with the specified character until it reaches the desired length . if the string is longer than this length , then it returns the unchanged string .
