java------------------------Math、System、BigInteger等类

关于java的学习记录:

1.Math类概述:

Math类包含用于执行基本数学运算的方法,如初等指数,对数,平方根和三角函数

成员方法:

public static int abs(int a)  求绝对值

public static double ceil(double a)  求上整数界

public static double floor(double a)  求下整数界

public static int max(int a,int b)  求最大值

public static double pow(double a,double b)  求前面数的后面数次方

public static double random()  生成0.0到1.0之间的小数,包含0.0,不包含1.0

public static int round(float a)  四舍五入

public static double sqrt(double a)  求平方根

java------------------------Math、System、BigInteger等类

java------------------------Math、System、BigInteger等类

java------------------------Math、System、BigInteger等类

java------------------------Math、System、BigInteger等类

2.随机数Random

java------------------------Math、System、BigInteger等类

java------------------------Math、System、BigInteger等类

3.System类的概述:

System类包含一些有用的类字段和方法,它不能被实例化

成员方法:public static void gc()垃圾清扫

public static void exit(int status)退出

public static void long currentTimeMillis()获取当前时间毫秒值

public static void arraycopy(Object src,int srcPos,Object dest,int destPos,int length)

源数组 源数组起始位置 目标数组目标数组中起始位置 长度

4.BigInteger的概述

可以让超过integer范围内的数据进行运算

构造方法:public BigInteger(String val)

成员方法:

public BigInteger add(BigInteger val)

public BigInteger subtract(BigInteger val)

public BigInteger multiply(BigInteger val)

public BigInteger divide(BigInteger val)

public BigInteger[] divideAndRemainder(BigInteger val)

java------------------------Math、System、BigInteger等类

5.BigDecimal的概述

由于在运算时,float类型和double类型都容易丢失精度,所以,为了能精确的表示,计算浮点数,java提供了BigDecimal不可变的、任意精度的有符号十进制数

构造方法:public BigDecimal(String val)

成员方法:public BigDecimal add(BigDecimal augend)

public BigDecimal subtract(BigDecimal subtrachend)

public BigDecimal multiply(BigDecimal multiplicand)

public BigDecimal divide(BigDecimal dicisor)

java------------------------Math、System、BigInteger等类

6.Date类的概述java.util.*;Date表示特定的瞬间,精确到毫秒

构造方法:public Date()  

public Date(long date)

成员方法:public long getTime()

public void setTime(longtime)

java------------------------Math、System、BigInteger等类