question: public static String pad ( String str , int totalChars ) { if ( str == null ) str = "null" ; int slen = str . length ( ) ; StringBuffer sb = new StringBuffer ( str ) ; for ( int i = 0 ; i < totalChars - slen ; i ++ ) { sb . append ( " " ) ; } return sb . toString ( ) ; }
target:  Return a String of length a minimum of totalChars characters by padding the input String str with spaces. If str is already longer than totalChars, it is returned unchanged.