The following example shows how to use Collections min and max API.
It returns the minimum/maximum element of the given collection,
according to the natural ordering of its elements.
//Returns the maximum/minimum element of the given collection,
//according to the natural ordering of its elements.
System.out.println("Max of " + intList + " is " + Collections.max(intList));
System.out.println("Min of " + intList + " is " + Collections.min(intList));