java比较两个任意类型数值的大小
解决方法:
public static void main(String[] args) {
BigDecimal a = new BigDecimal("0.21");
BigDecimal b = new BigDecimal(0.22F);
int compareTo = a.compareTo(b);
if(compareTo==0){
System.out.println("ab值相等");
}else if(compareTo==1){
System.out.println("a大于b");
}else if(compareTo==-1){
System.out.println("b大于a");
}
}