public class Test11 {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
TreeSet<Integer> ts = new TreeSet<>(new Comparator<Integer>() {
@Override
public int compare(Integer i1, Integer i2) {
int num = i2.compareTo(i1);
return num == 0 ? 1 : num;
}
});
// 请输入5个数字
for (int i = 1; i <= 5; i++) {
System.out.println("请输入第" + i + "个数字:");
int num = sc.nextInt();
ts.add(num);
}