Java 输入一组数字,用穷举的方法列出

import java.util.Scanner;

public class TestScanner {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Password: ");
long password = scanner.nextLong(); long pwd = 0;
long t1 = System.currentTimeMillis();
while (pwd != password) {
++pwd;
}
long t2 = System.currentTimeMillis();
System.out.printf("The password you entered is %s\n", password);
System.out.printf("elapsed time: %s ms", (t2 - t1));
scanner.close();
}
}
上一篇:c – 有没有办法向Vim添加自定义键盘快捷键以运行大量命令?


下一篇:(转)RabbitMQ消息队列(九):Publisher的消息确认机制