Write a method to return a string which is the parameter with add extra blanks to the left end to make it length width. If the string is already width characters or longer, no padding should be performed.
public static String padLeft(String s, int width)
Note: This is declared static because it is doesn't depend on instance variables from the class it would be defined in. It's declared public only because it might be generally useful.
|Three blanks added.|
|No blanks added; the string is already longer than width.|
|Four blanks total.|
|Four blanks added.|
The simplest, but not the most efficient, is to loop adding blanks to the left until the string is long enough. The reason this isn't efficient for a large amount of padding is that each time thru the loop creates a new String object.
Write only the method. You do not need to write a class or test program.