The beauty of Java is that this could be done in multiple ways. The sample code below reads in a single line of numbers and converts that to an array of Integers using the Java 8 Stream() and mapToInt() method.