Math
System.out.println(Math.abs(-99));//99
System.out.println(Math.sqrt(4));//2.0 开平方
System.out.println(Math.cbrt(8));//2.0 开立方
System
//0:当前虚拟机正常停止
//非0:异常停止
System.exit(0);
![]YNPXR@Z4@Y`{TJ)A7S.png](p3-juejin.byteimg.com/tos-cn-i-k3…?)
Runtime
![7FYHS$XI0%3K]@8@`H6AOV1.png](p9-juejin.byteimg.com/tos-cn-i-k3…?)
//获得Runtime对象
System.out.println(Runtime.getRuntime().availableProcessors());//12
//总内存大小
System.out.println(Runtime.getRuntime().maxMemory()/1024/1024);//4064
//已经获取内存的大小
System.out.println(Runtime.getRuntime().totalMemory()/1024/1024);//254
//剩余内存大小
System.out.println(Runtime.getRuntime().freeMemory()/1024/1024);
//-s:默认一分钟关机
//-s -t:指定关机时间
//-a:取消关机操作
//-r:关机重启
Runtime.getRuntime().exec("shutdown -s -t 3600");
Object
![B0W$QU3LDT%FZ4)M{O6KDW.png
toString
equals
如果没有重写equals方法,那么默认使用Object中的方法进行比较,比较地址值是否相等
对象克隆
把A对象的属性值完全拷贝给B对象
- 浅克隆,浅拷贝
- 深克隆,深拷贝
Objects
![27Y))0N6M{C)UT]N9[G5UL.png
![O_E1@]R6ZOG6AR8]8JPWO04.png](p9-juejin.byteimg.com/tos-cn-i-k3…?)
BigInteger

BigInteger的构造方法
Random r=new Random();
//获取一个随机大整数
BigInteger bd1=new BigInteger(4,r);
System.out.println(bd1);//[0~15)
//获取一个指定大整数
//字符串中必须是整数
BigInteger bd2=new BigInteger("99999999");
System.out.println(bd2);//99999999
//获取一个指定大整数
//字符串中的数字要与进制符合
BigInteger bd3=new BigInteger("100",2);//2进制的100
System.out.println(bd3);//4
//能表示范围比较小,只能在long范围之内
//提前把-16~16先创建好BigInteger的对象,如果多次获取不会重新创建新的
BigInteger bd4 = BigInteger.valueOf(100);
System.out.println(bd4);//100
![5@}L]O]YR77~37XGZM5Y9)1.png](p1-juejin.byteimg.com/tos-cn-i-k3…?)
BigInteger的成员方法
public static void main(String[] args) {
BigInteger bd1=BigInteger.valueOf(10);
BigInteger bd2=BigInteger.valueOf(5);
BigInteger bd3=bd1.add(bd2);
System.out.println(bd3);//15
}
BigInteger底层存储方式
BigDecimal
public static void main(String[] args) {
//通过传递double类型的小数来创建对象
//可能不精确
BigDecimal bd1=new BigDecimal(0.01);
System.out.println(bd1);//.01000000000000000020816681711721685132943093776702880859375
//通过传递字符串表示的小数来创建对象
BigDecimal bd3=new BigDecimal("0.01");
System.out.println(bd3);//0.01
//通过静态方法创建对象
BigDecimal bd4 = BigDecimal.valueOf(10);
System.out.println(bd4);//10
}
BigDecimal的使用
![L$@`00PW4S}L]K2OJ7AY(VQ.png](p3-juejin.byteimg.com/tos-cn-i-k3…?)