package cn.learn.basic; /* java.util.Math类含有大量的静态方法 public static double abs(double num) -求double绝对值 public static double ceil(double num) -向上取整 public static double floor(double num) -向下取整 public static long round(double) -四舍五入 */ public class MathApi { public static void main(String[] args) { double num=-1.2; System.out.println(Math.abs(num)); //1.2 System.out.println(Math.ceil(num)); //-1.0 } }