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

Posted heismk

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
", password);
        System.out.printf("elapsed time: %s ms", (t2 - t1));
        scanner.close();
    }
}

 

以上是关于Java 输入一组数字,用穷举的方法列出的主要内容,如果未能解决你的问题,请参考以下文章