According to me what you can do is take the input as a string and then divide it accordingly. If you want the input to be Integer then you can typecast it. Here is a small example for taking the input of an array in one line.
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(br.readLine()); //Length of Array
String s= br.readLine(); //Input the number seperated by space
int arr= new int[num];
String s1 = s.split(" ");
This will work.