// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class GenMax {
    public static <T extends Comparable<? super T>> T Max(T a, T b) {
        if (a == null) return b;
        if (b == null) return a;
        if (a.compareTo(b) >= 0)
            return a;
        else return b;
    }
    public static void main(String[] args) {
        System.out.println(Max(123,456));
        System.out.println(Max(12.3,45.6));
        System.out.println(Max("ABC","DEF"));
    }
}
