substring is a good idea and you need to see a pattern. Think of it this way, the first 3 characters you need to grab are indexed 0-2 in the string. The second three characters are indexed 3-5.
If you remember, substring(a, b) means that a is the index of the first character up through, but not including the character at index b.
So if the String you are trying to get the substrings from is named sequence, then
sequence.substring(0,3) if the first 3 characters, sequence.substring(3,6) the next three, sequence.substring(6,9) the next three, and so on.
You need to see a pattern in those indices and use a loop to get them all.