
public class Test1 {
public static void main(String[] args) throws IOException {
File file = new File("InputAndOutput.txt");
PrintWriter output = new PrintWriter(file);
Random seed = new Random();
for (int i = 0; i < 100; i++) {
int a = seed.nextInt(100);
output.print(a + " ");
}
output.close();
Scanner input = new Scanner(file);
Integer[] list = new Integer[100];
int i = 0;
while (input.hasNext()) {
String str = input.next();
list[i] = Integer.parseInt(str);
i++;
}
input.close();
Arrays.sort(list);
for (i = 0; i < 100; i++) {
System.out.println(list[i]);
}
}
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)