Answer the question
In order to leave comments, you need to log in
How to shuffle digits inside a number?
A=1234
and for example there should be 24 different numbers,
1243
1342
1324
etc
Answer the question
In order to leave comments, you need to log in
I can assume that you were given the task to do it manually, if so, then the algorithm will be something like this in the simplest version for Java.
1) Convert number to string. Integer.toString();
2) Parse the resulting string into an array. "string".toCharArray();
3) Interfere with the array.
4) Translate the array back into a string String.valueOf("array")
5) Translate the string back into a number. Integer.parseInt("string");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question