private String ljust ( String s , Integer length ) { if ( s . length ( ) >= length ) { return s ; } length -= s . length ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( Integer i = 0 ; i < length ; i ++ ) { sb . append ( " " ) ; } return s + sb . toString ( ) ; }
Left justify a string by forcing it to be the specified length . This is done by concatonating space characters to the end of the string until the string is of the specified length . If however the string is initially longer than the specified length then the original string is returned .