向上取整用Math.ceil(double a) 向下取整用Math.floor(double a) 举例: public static void main(String[] args) throws Exception { double a = 35; double b = 20; double c = a / b; System.out.println("c===>" + c); // 1.75 System.out.println("c===>"…
java 中取整操作提供了四种方法:分别是: public static double ceil(double a)//向上取整 public static double floor(double a)//向下取整 public static long round(double a)//四舍五入取整 public static double rint(double a)//最近取整 第一种:ceil是天花板的意思,表示向上取整. 测试: System.out.println(M…