29#System&Math&Arrays&Big Data

System

  • 方法
static long currentTimeMillis();
static void exit(int status);//终止JVM,0表示开启
static void gc();//运行垃圾回收器
static String getProperty(String key);
arraycopy(Object src, int srcPos, Object dest, int destPos, int length);

Math

  • 方法
static double abs();
static double ceil();
static double floor();
static double pov(a,b);//a的b次幂
static double sqrt(a);//的平方根
static double random();//[0.0,1.0) 
static long round(double d);
static double max/min(double a, double b);

Arrays

  • 方法
static int binarySearch(int[] a, int key);
static void sort(int[] a);//升序
static String toString(int[] a);//数组内容字符串的形式

BigInteger

  • 构造方法
BigInteger(String amazingNumber);
  • 方法
BigInteger add(BigInteger in)
BigInteger subtract(BigInteger in)
BigInteger multiply(BigInteger in)
BigInteger divied(BigInteger in)

BigDecimal

计算机二进制中,表示浮点数不精确造成的,而超级大型的浮点数据提供高精度的浮点运算,BigDecimal

  • BigDecimal的构造方法如果传入double会有一定的不可预知性,就因为浮点数的不精确造成的,因此默认传入字符串类型。
BigDecimal add(BigDecimal de)
BigDecimal subtract(BigDecimal de)
BigDecimal multiply(BigDecimal de)
BigDecimal divied(BigDecimal de)
  • 在除法的时候会出现因为结果是无限循环或者不循环的小数所造成的Exception
  • 四舍五入是的模式是:ROUND_HALF_UP
BigDecimal divide(BigDecimal divisor, int scale, int roundingMode);
scale:保留几位小数
roundingMode:保留模式

猜你喜欢

转载自blog.csdn.net/weixin_43660263/article/details/86555703