java.lang.Math类提供了常用的数学运算方法和两个静态常量E(自然对数的底数)和PI(圆周率)
Math.abs(-3.5);--------返回绝对值
Math.max(2.5,90.3);----返回最大值
Math.round(12.3);-----四舍五入
Math.round(12.4f);-----四舍五入
Math.floor(12.4);----向下取整
Math.ceil(22.4);----向上取整
Math.sqrt(2);-------返回2的平方根
Math.log(e);-----求对数
Math.log1p();-----返回参数与1的和的对数
int random = (int)(Math.random()*10);----生成一个0~9之间的随机数
Date类(idea-2021.1.27-enum)
Date d1 = new Date();------获取当前时间
Date d2 = new Date(1600000000000L);-----用时间戳(1970年1月1日至今的毫秒数)
SimpleDateFormat form=new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar calendar = form.getCalendar();
Date date = calendar.getTime();-----获取最近一个使用form的日期