Math工具类

public static void main(String[] args) {
// 工具类,所有方法都以静态方法提供,没有实例存在的意义
// 不提供任何实例的方法,代表当前类属于无状态的。
// 不需要下一代进化,终极版
// PI/6 3.14/6=
// 弧度, 度数 30degree(不是这个)
System.out.println(Math.sin(0.525));//返回角度的三角正玄 // 绝对值
System.out.println(Math.abs(-333.33));//绝对值 // 四舍五入
System.out.println(Math.round(3.48));//四舍五入
System.out.println(Math.round(3.58));//四舍五入
// 看绝对值,再加符号
System.out.println(Math.round(-3.48));//先进性绝对值 然后再加-号
System.out.println(Math.round(-3.58));//先进性绝对值 然后再加-号 System.out.println(Math.round(3.6873));
System.out.println(Math.round(5.45643));
System.out.println(Math.min(3, 5));
System.out.println(Math.max(45,67)); // 保留多少位有效数字
// round(doubel a , int len); // floor 地板,下
//System.out.println("便于查看");
System.out.println(Math.floor(3.77));
// 天花板
System.out.println(Math.ceil(3.48)); // 下, -4 在下面 -3 3.4上面
//System.out.println("便于查看1");
System.out.println(Math.floor(-3.4));
System.out.println(Math.floor(-3.7));
System.out.println(Math.ceil(-3.48));
// 指数函数
System.out.println(Math.pow(2, 5));
// System.out.println(Math.toDegrees(0.5)); // 转换为度数
System.out.println((int)(Math.random()*10));
String name = "fjfg";
System.out.println(name.);
// 二维图形 }
char c=(char)(int)(Math.random()*26+97);
System.out.println(c);//生成随机26个字母中的一个
上一篇:div宽度设置width:100%后再设置padding或margin超出父元素的解决办法


下一篇:虚拟机VMware克隆之后网络不可用的解决办法