question: public static String wrap ( String s , int n ) { StringBuffer b = new StringBuffer ( ) ; boolean wrapPending = false ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { if ( i % n == 0 && i > 0 ) { wrapPending = true ; } char c = s . charAt ( i ) ; if ( wrapPending && c == ' ' ) { b . append ( "\n" ) ; wrapPending = false ; } else { b . append ( c ) ; } } return b . toString ( ) ; }
target:  Line-wraps a string s by inserting CR-LF instead of the first space after the nth columns.