向上取整用Math.ceil(double a)
向下取整用Math.floor(double a)
例如:
System.out.println(Math.ceil(1.21));
System.out.println(Math.floor(1.21));
结果:
2.0;
1.0;
向上取整用Math.ceil(double a)
向下取整用Math.floor(double a)
例如:
System.out.println(Math.ceil(1.21));
System.out.println(Math.floor(1.21));
结果:
2.0;
1.0;