private static int lineWrapIndex(String line,int maxWidth){
  for (int i=maxWidth; i > 0; i--) {
    if (isLineWrapChar(line.charAt(i))) {
      return i;
    }
  }
  for (int i=maxWidth + 1; i < line.length(); i++) {
    if (isLineWrapChar(line.charAt(i))) {
      return i;
    }
  }
  return line.length();
}

private static int lineWrapIndex ( String line , int maxWidth ) { for ( int i = maxWidth ; i > 0 ; i -- ) { if ( isLineWrapChar ( line . charAt ( i ) ) ) { return i ; } } for ( int i = maxWidth + 1 ; i < line . length ( ) ; i ++ ) { if ( isLineWrapChar ( line . charAt ( i ) ) ) { return i ; } } return line . length ( ) ; }
returns the index on which to insert a newline given maxwidth .
