import java.util.*;

class Main {
    public static void main(String[] args) {
        ArrayList<Integer> l = new ArrayList<>();
        l.add(5);
        l.add(10);
        l.add(3);
        l.add(4);
        l.sort((a, b) -> b - a);
        // l.sort((a, b) -> {
        //   if (a == b) {
        //     return 0;
        //   }
        //   if (a > b) {
        //     return -1;
        //   }
        //   return 1;
        // });
        System.out.println(l);
    }
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: