gpt4 book ai didi

java - 生成所有10位数字的组合,不重复

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:50:01 25 4
gpt4 key购买 nike

<分区>

我有一个关于通过 Java 创建密码的作业:

Suppose you work in a safe selling company and your manager asked you to create a list of all the ten digit numbers between 0000000000 and 9999999999 without repeating a digit in the same number. What is the method to do this algorithm in JAVA?

这是我到目前为止所做的:

public static long generateNumber()  
{
String s1 = "33333";
double d = Math.random();
d=d*100000.0;
int i = (int) d;
String s2 = String.valueOf(i);
String s3=s1+s2;
long m = Long.parseLong(s3);
return m;
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com