import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
List list = new ArrayList();
while (true) {
System.out.print("输入一个整数(输入0结束):");
int x = reader.nextInt();
if (x == 0) {
break;// 输入0时结束
} else {
list.add(x);
}
}
/* 冒泡排序:从大到小 */
for (int i = 0; i < list.size(); i++) {
for (int j = 0; j < list.size(); j++) {
if (list.get(i) > list.get(j)) {
int temp = list.get(i);
list.set(i, list.get(j));
list.set(j, temp);
}
}
}
System.out.println("最大值:" + list.get(0) + ", 最小值:" + list.get(list.size()-1));
}
}