public static int max(int[] data){
int max = data[0];
for(int i:data){
max = max>i ? max : i;
}
return max;
}
先排序,后取值
public static int max(int[] data){
Arrays.sort(data.clone());
return data[data.length-1];
}
查询次第二大的值
public static int getSecond(Integer[] data){
List dataList = Arrays.asList(data);
TreeSet ts = new TreeSet(dataList);
return ts.lower(ts.last());
}



