You can use the split method on the String containing the numbers in order to get an array of all the numbers. Also, you may want to store each array of numbers in a List as an alternative.