For arrays we can use:
int[] arr = Arrays.stream(br.readLine().trim.split("\\\\s+")) .maptoInt(Integer::parseInt) .toArray();