Skip to content

Instantly share code, notes, and snippets.

JalonZhou zhoujinl

View GitHub Profile
View gist:777214a3a3b7e0ec22f6f1f3878f5517
import java.util.Comparator;
import java.util.stream.Collectors;
public class DescendingOrder {
public static int sortDesc(final int num) {
return Integer.parseInt(String.valueOf(num)
.chars()
.mapToObj(i -> String.valueOf(Character.getNumericValue(i)))
.sorted(Comparator.reverseOrder())
.collect(Collectors.joining()));
You can’t perform that action at this time.