public static String insertBreakingWhitespace(int lineLen,String original){
  if (original == null || lineLen <= 0)   throw new IllegalArgumentException();
  int length=original.length();
  if (length <= lineLen)   return original;
  int currPos=0;
  StringBuilder retval=new StringBuilder();
  while (length - currPos > lineLen) {
    retval.append(original.substring(currPos,currPos + lineLen));
    currPos+=lineLen;
    retval.append(" ");
  }
  retval.append(original.substring(currPos,length));
  return retval.toString();
}

public static String insertBreakingWhitespace ( int lineLen , String original ) { if ( original == null || lineLen <= 0 ) throw new IllegalArgumentException ( ) ; int length = original . length ( ) ; if ( length <= lineLen ) return original ; int currPos = 0 ; StringBuilder retval = new StringBuilder ( ) ; while ( length - currPos > lineLen ) { retval . append ( original . substring ( currPos , currPos + lineLen ) ) ; currPos += lineLen ; retval . append ( " " ) ; } retval . append ( original . substring ( currPos , length ) ) ; return retval . toString ( ) ; }
inserts spaces every splitlen characters so that the string will wrap .
