question: protected String padString ( String s , int length , boolean left ) { String result ; int i ; result = s ; for ( i = s . length ( ) ; i < length ; i ++ ) { if ( left ) { result = " " + result ; } else { result = result + " " ; } } if ( ( length > 0 ) && ( result . length ( ) > length ) ) { result = result . substring ( 0 , length ) ; } return result ; }
target:  pads the given string until it reaches the given length, if longer cuts it down. if length is 0 then nothing is done.