公式:(本期数量-上期数量)/上期数量*100%
)
代码:
public static void main(String[] args) {
Integer bcount = 119; // 本期数量
Integer scount = 158; // 上期数量
BigDecimal tests = BigDecimal.valueOf((bcount - scount ) * 100).divide(BigDecimal.valueOf(scount ), 2, BigDecimal.ROUND_HALF_DOWN);
System.out.println(tests +"%");
}