向上取整:Math.ceil(double a)
向下取整:Math.floor(double a)
四舍五入取整:Math.round(double a)
直接取整数:intValue()
public static void main(String[] args) {
Double number = 5.3;
Double number1 = 5.8;
//向上取整
Double ceil = Math.ceil(number);
System.out.println("向上取整:" + ceil);
//向下取整
Double floor = Math.floor(number);
System.out.println("向下取整:" + floor);
//四舍五入
double round = Math.round(number);
double round1 = Math.round(number1);
System.out.println("四舍五入:" + round);
System.out.println("四舍五入:" + round1);
//直接取整数
int intValue = number.intValue();
System.out.println("直接取整数:" + intValue);
}














![[架构之路-221]:鸿蒙系统和安卓系统的比较:微内核VS宏内核, 分布式VS单体式](https://img-blog.csdnimg.cn/9690df1791a041a8b848d3080ca01510.png)





