java - Generate all combinations of 10 digits without any repetition -


this question has answer here:

i having assignment creating password through java:

suppose work in safe selling company , manager asked create list of ten digit numbers between 0000000000 , 9999999999 without repeating digit in same number. method algorithm in java?

here's i've done far:

public static long generatenumber()   {       string s1 = "33333";       double d = math.random();       d=d*100000.0;       int = (int) d;       string s2 = string.valueof(i);       string s3=s1+s2;       long m = long.parselong(s3);       return m; } 

if you're looking ten digit numbers without duplicate digits, you're looking generate permutations of digits, i.e. string "0123456789".

there other threads on this, example these


Comments

Popular posts from this blog

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -