public static String padLeft(String s,int length){
  if (s.length() > length) {
    throw new RuntimeException(s + " cannot be padded to length " + length+ ", it is too long");
  }
  String t="";
  for (int i=0; i < length - s.length(); i++) {
    t+=" ";
  }
  return t + s;
}

public static String padLeft ( String s , int length ) { if ( s . length ( ) > length ) { throw new RuntimeException ( s + " cannot be padded to length " + length + ", it is too long" ) ; } String t = "" ; for ( int i = 0 ; i < length - s . length ( ) ; i ++ ) { t += " " ; } return t + s ; }
returns a string that is the given string padded on the left to the given length .
