输入字符,用空格隔开,未知数量
public static void main(String[] args) throws IOException {
//System.out.println("请输入几个数,用空格分开");
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
String[] arr = str.split(" ");//接收空格
int[] b = new int[arr.length];
for(int j = 0; j<b.length;j++) {
b[j] = Integer.parseInt(arr[j]);
System.out.print(b[j] + " ");
}
}