+ 2
write a program to arrange digits of a number in ascending order
4 ответов
+ 13
1)take number as String value
2)convert it to char array
3)use Arrays.sort(array);
4)print array
//☺👍
+ 10
int number = 4214;
List<Integer> numbers = new LinkedList<>(); // a LinkedList is not backed by an array
for (int i = number; i > 0; i /= 10)
numbers.add(i % 10);
numbers.stream().sorted().forEach(System.out::println);
+ 3
learn Java tutorial array part, made it by your own.
0
you can use while or for loop nad compare each element and than change thier places accordingly I have no idea about Java but if you want I can give the code in python. but it always good to learn by your self.