向上取整用:Math.ceil(double a) 向下取整用:Math.floor(double a)
int a = 7;
int b = 5;
BigDecimal aBig = new BigDecimal(a);
BigDecimal bBig = new BigDecimal(b);
//向上取整
int num1 = (int)Math.ceil(aBig.divide(bBig).doubleValue());
//向下取整
int num2 = (int)Math.floor(aBig.divide(bBig).doubleValue());
System.out.println("正常值:"+aBig.divide(bBig));
System.out.println("向上取整:"+num1);
System.out.println("向下取整:"+num2);
参考:java 除法向上,向下取整 - 秋香姑娘请你不要紧张 - 博客园