java大数值与数组

1.BigInteger和BigDecimal, 可以处理包含任意长度数字序列的数值。
主要的api:
- add 加
- subtract 减
- multiply 乘
- divide 除
- mod 取余
- compareTo 比较大小
- valueOf


2.java只有一维数组,多位数组被解释为”数组的数组”,从而可以构建不规则数组,例如:
int[][] arr = new int[NMAX][] //定义数组
// 初始化
for(int =0; i < NMAX; n++) arr[n] = new int[n]

java.util.Arrays:

  • static String toString(type[] a)
  • static type[] copyOf(type [] a, int length)
  • static sype[] copyOfRange(type[], int start, int end)
  • static void sort(type[] a)
  • static int binarySearch(type[] a, type v)
  • static int binarySearch(type[] a, int start, int end, type v)
  • static void fill(type[] a type v):将数组所有元素设置为v
  • static boolean void equals(type[] a, type[] b):如果两个数组大小相同,并且下标相同的元素都对应相等,那么返回true
  • type为java的8中基本数据类型

你可能感兴趣的:(java)