C++读取一行整数到数组中
int temp;
vector<int> arr;
while(cin>>temp&&getchar()!='\0')
arr.emplace_back(temp);
java读取一行整数到数组中
Scanner in = new Scanner(System.in);
int x = 0;
if (in.hasNextInt()) x = in.nextInt();
List<Integer> list = new ArrayList<>();
while (in.hasNextInt()) {
list.add(in.nextInt());
}