I want to sort a List of Strings in descending order.
I tried different comparators but none is giving the answer i am looking for.
public class arrasss {
public static void main(String[] args) {
// TODO Auto-generated method stub
List<String> a1 = Arrays.asList("7560923143", "7560923053", "7560922899", "7560922344", "7560504628",
"7280202486", "7280202087", "7280202068", "353549090116186", "353549090116079", "353549090114991",
"353549090113191", "353549090112896", "353549090000007");
a1.sort(Comparator.reverseOrder());
// Collections.reverse(a1);
System.out.println(a1);
}
}
Received Answer: [7560923143, 7560923053, 7560922899, 7560922344, 7560504628, 7280202486, 7280202087, 7280202068, 353549090116186, 353549090116079, 353549090114991, 353549090113191, 353549090112896, 353549090000007]
Expected Answer : 353549090116186 353549090116079 353549090114991 353549090113191 353549090112896 353549090000007 7560923143...