In other words, you're looking to implement a bog-standard old-time text formatting utility.
You've got 2 possible strategies here. One is to use a scanner to break the text down into tokens and keep appending tokens into a StringBuilder until you reach the limit, then output the StringBuilder contents as a String. Reset the StringBuilder to empty and start appending from there. There really isn't anything more primitive that StringBuilder in
Java.
The other is faster, but maybe a bit more brutal - use a regex to suck up as large a set of characters from the source string(s) as will fill out the StringBuilder buffer, rinse and repeat until you run out of sources.
And, of course, either way, don't forget to flush out the buffer at the end! (I always forget).
The regex way is probably more performant and more likely to preserve non-semantic constructs such as multiple adjacent spaces (depending on how your scanner works). The scanner, on the other hand, can be more intelligent about how it handles tokens. And, unlike regex'es is less likely to injure your sanity. So it's a matter of which suits you better.