I tried to search online to solve this question but I didn\'t found anything.
I wrote the following abstract code to explain what I\'m asking:
String
Using Guava:
Iterable result = Splitter.fixedLength(4).split("how are you?"); String[] parts = Iterables.toArray(result, String.class);