Here you can find the source of findMax(T[] arr)
public static <T extends Comparable<? super T>> T findMax(T[] arr)
//package com.java2s; //License from project: Open Source License public class Main { public static <T extends Comparable<? super T>> T findMax(T[] arr) { int maxIndex = 0; for (int i = 1; i < arr.length; i++) if (arr[i].compareTo(arr[maxIndex]) > 0) maxIndex = i;//w w w . j ava2 s .c om return arr[maxIndex]; } }