public static String getMin(List list) {
String min = null;
String temp = null;
for (int i = 0; i < list.size(); i++) {
if (StringUtils.isNotEmpty(temp)) {
BigDecimal d =new BigDecimal(temp);
if(d.compareTo(new BigDecimal(list.get(i)))<=0){
min = temp;
}else {
min = list.get(i);
temp = min;
}
}else {
temp = list.get(i);
}
}
return min;
}
public static String getMax(List list) {
String max = null;
String temp = null;
for (int i = 0; i < list.size(); i++) {
if (StringUtils.isNotEmpty(temp)) {
BigDecimal d =new BigDecimal(temp);
if(d.compareTo(new BigDecimal(list.get(i)))>=0){
max = temp;
}else {
max = list.get(i);
temp = max;
}
}else {
temp = list.get(i);
}
}
return max;
}
public static void main(String[] args) {
List list = Arrays.asList( "25", "3.35E-05", "-1.25", "22", "7.5", "27", "24", "29", "-11", "26");
System.out.println(getMax(list));
System.out.println(getMin(list));
}