int num = 5542;
String number = String.valueOf(num);
for(int i = 0; i < number.length(); i++) {
int j = Character.digit(number.charAt(i), 10);
System.out.println("digit: " + j);
}
String str = "1 16 217 22 992";
String[] numbersAsStrings = str.split(" ");
int[] numbers = new int[numbersAsStrings.length];
for (int i = 0; i < numbersAsStrings.length; i++) {
numbers[i] = Integer.parseInt(numbersAsStrings[i]);
}