Use String.split() with a regex \\s+ (or \n+ for example, depending on what you exactly want).
You can concat 2 or more strings if needed, but after you have the array using split() - it should be fairly easy, give it a try!
good luck. Feel free to ask any question if you are having troubles implementing the 2nd part.
EDIT: seems like you are having troubles with concatting the strings. This shou;d be done with simple iteration and a StringBuilder:
int SIZE = 4;
String[] arr = str.split("\\s+");
List<String> res = new ArrayList<>();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
sb.append(arr[i]).append('\n');
if (i % SIZE == SIZE-1) {
res.add(sb.toString());
sb = new StringBuilder();
}
}
if (sb.length() != 0) res.add(sb.toString());
System.out.println(res);
}
Note that res is a List<String>, if you want it as an array, you can always use the toArray() method.