question: public static String formatParagraph ( String src , int len , boolean breakOnWhitespace ) { StringBuilder str = new StringBuilder ( ) ; int total = src . length ( ) ; int from = 0 ; while ( from < total ) { int to = from + len ; if ( to >= total ) { to = total ; } else if ( breakOnWhitespace ) { int ndx = lastIndexOfWhitespace ( src , to - 1 , from ) ; if ( ndx != - 1 ) { to = ndx + 1 ; } } int cutFrom = indexOfNonWhitespace ( src , from , to ) ; if ( cutFrom != - 1 ) { int cutTo = lastIndexOfNonWhitespace ( src , to - 1 , from ) + 1 ; str . append ( src . substring ( cutFrom , cutTo ) ) ; } str . append ( '\n' ) ; from = to ; } return str . toString ( ) ; }
target:  Formats provided string as paragraph.