Java tutorial
import java.util.Collections; import java.util.LinkedList; public class Main { public static void main(String args[]) { // create linked list object LinkedList<Integer> list = new LinkedList<Integer>(); // populate the list list.add(-2); list.add(2); list.add(-12); list.add(8); // sort the list Collections.sort(list, Collections.reverseOrder()); System.out.println("List sorted in natural order: "); System.out.println(list); } }