If i input 1324,3591
It mean i want the bigger denote in order.
int x = 1324;
int y = 3591;
System.out.println(x+y);
I want the output show:
4321 and 8531
If i input 1324,3591
It mean i want the bigger denote in order.
int x = 1324;
int y = 3591;
System.out.println(x+y);
I want the output show:
4321 and 8531
Create two function, public int[] orderAsIncreasing(int input[])
and public int[] orderAsDecreasing(int input[])
.
Then, loop inside the input searching for the highest value, and place it as the first/last in the output of each function. Remove that value from the array. Repeat until the array is empty. Then return the result
I will not post code, since this looks like some sort of homework. The logic is there. Now, use google and documentations to get the operators for it.
I think you should convert the numbers to strings and then to char arrays. If 'number' is your number, then something like:
String numberAsString = String.valueOf(number);
char[] charArray = numberAsString.toCharArray();
Arrays.sort(charArray);
String newNumberAsString = new String(charArray);
int number2= Integer.valueOf(newNumberAsString);