Try to split that string like:
String[] numbers = sb.toString().split(" ");//if spaces are uneven, use \\s+ instead of " "
for (String number : numbers) {
list.add(Integer.valueOf(number));
}
4
solved Converting a StringBuilder To Integer Values In Java [duplicate]