BigDecimal类型比较大小
作者:互联网
if (a.compareTo(b) == -1) {
System.out.println("a小于b");
}
if (a.compareTo(b) == 0) {
System.out.println("a等于b");
}
if (a.compareTo(b) == 1) {
System.out.println("a大于b");
}
if (a.compareTo(b) > -1) {
System.out.println("a大于等于b");
}
if (a.compareTo(b) < 1) {
System.out.println("a小于等于b");
}
搜索
复制
标签:小于,BigDecimal,等于,System,大小,compareTo,类型,println,out 来源: https://www.cnblogs.com/myself1012/p/16338467.html