java的BigDecimal比较大小
作者:互联网
//前提为a、b均不能为null 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"); }
标签:小于,java,BigDecimal,等于,System,println,compareTo,大小,out 来源: https://www.cnblogs.com/deepalley/p/15410268.html