Scanner sc = new Scanner(System.in);
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < 5; i++) {
list.add(sc.nextInt());
}
Collections.sort(list);//此类中的sort方法可以用来升序排序
for(int i = 0; i < list.size(); i++){
int j = list.get(i);
System.out.println(j);
}
GO TO FULL VERSION