I am using BufferedReader class to read inputs in my Java program. I want to read inputs from a user who can enter multiple integer data in single line with space. I want to rea
Late to the party but you can do this in one liner in Java 8 using streams.
streams
InputStreamReader isr= new InputStreamReader(); BufferedReader br= new BufferedReader(isr); int[] input = Arrays.stream(br.readLine().split("\\s+")).mapToInt(Integer::parseInt).toArray();