您的位置:首页 > 编程语言 > Java开发

java 核心技术 卷1 第三章 常用方法

2012-12-28 15:30 471 查看
1. 大数

public class BigInteger
extends Numberimplements Comparable<BigInteger>不可变的任意精度的整数。
所有操作中,都以二进制补码形式表示 BigInteger(如 Java 的基本整数类型)。BigInteger 提供所有 Java 的基本整数操作符的对应物,
并提供 java.lang.Math 的所有相关方法。另外,BigInteger 还提供以下运算:模算术、GCD 计算、质数测试、素数生成、位操作以及一些其他操作。

public BigInteger add(BigInteger val)返回其值为 (this + val) 的 BigInteger。

参数:
val - 将添加到此 BigInteger 中的值。
返回:
this + val

--------------------------------------------------------------------------------

subtract
public BigInteger subtract(BigInteger val)返回其值为 (this - val) 的 BigInteger。

参数:
val - 从此 BigInteger 中减去的值。
返回:
this - val

--------------------------------------------------------------------------------

multiply
public BigInteger multiply(BigInteger val)返回其值为 (this * val) 的 BigInteger。

参数:
val - 要乘以此 BigInteger 的值。
返回:
this * val

--------------------------------------------------------------------------------

divide
public BigInteger divide(BigInteger val)返回其值为 (this / val) 的 BigInteger。

参数:
val - 此 BigInteger 要除以的值。
返回:
this / val
抛出:
ArithmeticException - val==0

--------------------------------------------------------------------------------

divideAndRemainder
public BigInteger[] divideAndRemainder(BigInteger val)返回包含 (this / val) 后跟 (this % val) 的两个 BigInteger 的数组。

参数:
val - 此 BigInteger 要除以的值和计算所得的余数。
返回:
两个 BigInteger 的数组:商 (this / val) 是初始元素,余数 (this % val) 是最终元素。
抛出:
ArithmeticException - val==0

--------------------------------------------------------------------------------

remainder
public BigInteger remainder(BigInteger val)返回其值为 (this % val) 的 BigInteger。

参数:
val - 此 BigInteger 要除以的值和计算所得的余数。
返回:
this % val
抛出:
ArithmeticException - val==0

--------------------------------------------------------------------------------

pow
public BigInteger pow(int exponent)返回其值为 (thisexponent) 的 BigInteger。注意,exponent 是一个整数而不是 BigInteger。

参数:
exponent - 此 BigInteger 的指数。
返回:
thisexponent
抛出:
ArithmeticException - exponent 为负。(这会导致该运算产生一个非整数值。)

--------------------------------------------------------------------------------

gcd
public BigInteger gcd(BigInteger val)返回一个 BigInteger,其值是 abs(this) 和 abs(val) 的最大公约数。如果 this==0 && val==0,则返回 0 。

参数:
val - 要一起计算最大公约数的值。
返回:
GCD(abs(this), abs(val))

--------------------------------------------------------------------------------

abs
public BigInteger abs()返回其值是此 BigInteger 的绝对值的 BigInteger。

返回:
abs(this)

--------------------------------------------------------------------------------

negate
public BigInteger negate()返回其值是 (-this) 的 BigInteger。

返回:
-this

--------------------------------------------------------------------------------

signum
public int signum()返回此 BigInteger 的正负号函数。

返回:
当此 BigInteger 的值为负、零或正时,返回 -1、0 或 1。

--------------------------------------------------------------------------------

mod
public BigInteger mod(BigInteger m)返回其值为 (this mod m) 的 BigInteger。此方法不同于 remainder,因为它始终返回一个 非负 BigInteger。

参数:
m - 模数。
返回:
this mod m
抛出:
ArithmeticException - m <= 0
另请参见:
remainder(java.math.BigInteger)

--------------------------------------------------------------------------------

modPow
public BigInteger modPow(BigInteger exponent,
BigInteger m)返回其值为 (thisexponent mod m) 的 BigInteger。(与 pow 不同,此方法允许使用负指数。)

参数:
exponent - 该指数。
m - 模数。
返回:
thisexponent mod m
抛出:
ArithmeticException - m <= 0
另请参见:
modInverse(java.math.BigInteger)

--------------------------------------------------------------------------------

modInverse
public BigInteger modInverse(BigInteger m)返回其值为 (this-1 mod m) 的 BigInteger。

参数:
m - 模数。
返回:
this-1 mod m.
抛出:
ArithmeticException - m <= 0,或者此 BigInteger 没有乘法可逆元 mod m(即此 BigInteger 不是 m 的相对素数)。

--------------------------------------------------------------------------------

shiftLeft
public BigInteger shiftLeft(int n)返回其值为 (this << n) 的 BigInteger。位移距离 n 可以为负,在此情况下,此方法执行右移操作。(计算 floor(this * 2n)。)

参数:
n - 以位为单位的位移距离。
返回:
this << n
另请参见:
shiftRight(int)

--------------------------------------------------------------------------------

shiftRight
public BigInteger shiftRight(int n)返回其值为 (this >> n) 的 BigInteger。执行符号扩展。位移距离 n 可以为负,在此情况下,此方法执行左移操作。(计算 floor(this / 2n)。)

参数:
n - 以位为单位的位移距离。
返回:
this >> n
另请参见:
shiftLeft(int)

--------------------------------------------------------------------------------

and
public BigInteger and(BigInteger val)返回其值为 (this & val) 的 BigInteger。(当且仅当 this 和 val 同时为负时,此方法返回一个负 BigInteger。)

参数:
val - 要与此 BigInteger 执行 AND(与)运算的值。
返回:
this & val

--------------------------------------------------------------------------------

or
public BigInteger or(BigInteger val)返回其值为 (this | val) 的 BigInteger。(当且仅当 this 和 val 之一为负时,此方法返回一个负 BigInteger。)

参数:
val - 要与此 BigInteger 执行或运算的值。
返回:
this | val

--------------------------------------------------------------------------------

xor
public BigInteger xor(BigInteger val)返回其值为 (this ^ val) 的 BigInteger。(当且仅当 this 和 val 中只有一个为负时,此方法返回一个负 BigInteger。)

参数:
val - 要与此 BigInteger 执行异或运算的值。
返回:
this ^ val

--------------------------------------------------------------------------------

not
public BigInteger not()返回其值为 (~this) 的 BigInteger。(当且仅当此 BigInteger 为非负时,此方法返回一个负值。)

返回:
~this

--------------------------------------------------------------------------------

andNot
public BigInteger andNot(BigInteger val)返回其值为 (this & ~val) 的 BigInteger。此方法等效于 and(val.not()),提供此方法是为了更方便地进行屏蔽操作。(当且仅当 this 为负且 val 为正时,此方法返回一个负 BigInteger。)

参数:
val - 要进行求补且与此 BigInteger 执行与运算的值。
返回:
this & ~val

--------------------------------------------------------------------------------

testBit
public boolean testBit(int n)当且仅当设置了指定的位时,返回 true。(计算 ((this & (1<<n)) != 0)。)

参数:
n - 要测试的位的索引。
返回:
当且仅当设置了指定的位时,返回 true。
抛出:
ArithmeticException - n 为负。

--------------------------------------------------------------------------------

setBit
public BigInteger setBit(int n)返回其值与设置了指定位的此 BigInteger 等效的 BigInteger。(计算 (this | (1<<n))。)

参数:
n - 要设置的位的索引。
返回:
this | (1<<n)
抛出:
ArithmeticException - n 为负。

--------------------------------------------------------------------------------

clearBit
public BigInteger clearBit(int n)返回其值与清除了指定位的此 BigInteger 等效的 BigInteger。(计算 (this & ~(1<<n))。)

参数:
n - 要清除的位的索引。
返回:
this & ~(1<<n)
抛出:
ArithmeticException - n 为负。

--------------------------------------------------------------------------------

flipBit
public BigInteger flipBit(int n)返回其值与对此 BigInteger 进行指定位翻转后的值等效的 BigInteger。(计算 (this ^ (1<<n))。)

参数:
n - 要翻转的位的索引。
返回:
this ^ (1<<n)
抛出:
ArithmeticException - n 为负。

--------------------------------------------------------------------------------

getLowestSetBit
public int getLowestSetBit()返回此 BigInteger 最右端(最低位)1 比特的索引(即从此字节的右端开始到本字节中最右端 1 比特之间的 0 比特的位数)。如果此 BigInteger 不包含一位,则返回 -1。(计算 (this==0? -1 : log2(this & -this))。)

返回:
此 BigInteger 中最右端的一比特位的索引。

--------------------------------------------------------------------------------

bitLength
public int bitLength()返回此 BigInteger 的最小的二进制补码表示形式的位数,不包括 符号位。对于正 BigInteger,这等于常规二进制表示形式中的位数。(计算 (ceil(log2(this < 0 ? -this : this+1)))。)

返回:
返回此 BigInteger 的最小的二进制补码表示形式中的位数,不包括 符号位。

--------------------------------------------------------------------------------

bitCount
public int bitCount()返回此 BigInteger 的二进制补码表示形式中与符号不同的位的数量。此方法在实现 BigInteger 上的位向量样式设置时非常有用。

返回:
返回此 BigInteger 的二进制补码表示形式中与符号位不同的位的数量。

--------------------------------------------------------------------------------

isProbablePrime
public boolean isProbablePrime(int certainty)如果此 BigInteger 可能为素数,则返回 true,如果它一定为合数,则返回 false。如果 certainty <= 0,则返回 true。

参数:
certainty - 调用方允许的不确定性的度量。如果该调用返回 true,则此 BigInteger 是素数的概率超出 (1 - 1/2certainty)。此方法的执行时间与此参数的值是成比例的。
返回:
如果此 BigInteger 可能为素数,则返回 true,如果它一定为合数,则返回 false。

--------------------------------------------------------------------------------

compareTo
public int compareTo(BigInteger val)将此 BigInteger 与指定的 BigInteger 进行比较。对于针对六个布尔比较运算符 (<, ==, >, >=, !=, <=) 中的每一个运算符的各个方法,优先提供此方法。执行这些比较的建议语句是:(x.compareTo(y) <op> 0),其中 <op> 是六个比较运算符之一。

指定者:
接口 Comparable<BigInteger> 中的 compareTo
参数:
val - 将此 BigInteger 与之比较的 BigInteger。
返回:
当此 BigInteger 在数值上小于、等于或大于 val 时,返回 -1,0,或 1。

--------------------------------------------------------------------------------

equals
public boolean equals(Object x)比较此 BigInteger 与指定的 Object 的相等性。

覆盖:
类 Object 中的 equals
参数:
x - 将此 BigInteger 与之比较的 Object。
返回:
当且仅当指定的 Object 是一个其值在数字上等于此 BigInteger 的 BigInteger 时,返回 true。
另请参见:
Object.hashCode(), Hashtable

--------------------------------------------------------------------------------

min
public BigInteger min(BigInteger val)返回此 BigInteger 和 val 的最小值。

参数:
val - 要计算最小值的值。
返回:
其值为此 BigInteger 和 val 中的较小值的 BigInteger。如果它们相等,可能返回其中之一。

--------------------------------------------------------------------------------

max
public BigInteger max(BigInteger val)返回此 BigInteger 和 val 的最大值。

参数:
val - 要计算最大值的值。
返回:
其值为此 BigInteger 和 val 中较大值的 BigInteger。如果它们相等,可能返回其中之一。

--------------------------------------------------------------------------------

hashCode
public int hashCode()返回此 BigInteger 的哈希码。

覆盖:
类 Object 中的 hashCode
返回:
此 BigInteger 的哈希码。
另请参见:
Object.equals(java.lang.Object), Hashtable

--------------------------------------------------------------------------------

toString
public String toString(int radix)返回此 BigInteger 的给定基数的字符串表示形式。如果该基数超出从 Character.MIN_RADIX 到 Character.MAX_RADIX(包括)这一范围,则其默认值为 10(Integer.toString 就是这种情况)。使用由 Character.forDigit 提供的从数字到字符的映射,并在需要时在前面加一个负号。(此表示形式与 (String, int) 构造方法兼容。)

参数:
radix - 字符串表示形式的基数。
返回:
此 BigInteger 给定基数的字符串表示形式。
另请参见:
Integer.toString(int, int), Character.forDigit(int, int), BigInteger(java.lang.String, int)

--------------------------------------------------------------------------------

toString
public String toString()返回此 BigInteger 的十进制字符串表示形式。使用由 Character.forDigit 提供的从数字到字符的映射,并在需要时在前面加一个负号。(此表示形式与 (String) 构造方法兼容,并允许使用 Java 的 + 运算符将字符串连接。)

覆盖:
类 Object 中的 toString
返回:
此 BigInteger 的十进制字符串表示形式。
另请参见:
Character.forDigit(int, int), BigInteger(java.lang.String)

--------------------------------------------------------------------------------

toByteArray
public byte[] toByteArray()返回一个 byte 数组,该数组包含此 BigInteger 的二进制补码表示形式。该 byte 数组将为 big-endian 字节顺序:最高有效字节在第零个元素中。此数组将包含表示此 BigInteger 所需的最小数量的字节,至少包括一个符号位,即 (ceil((this.bitLength() + 1)/8))。(此表示形式与 (byte[]) 构造方法兼容。)

返回:
一个包含此 BigInteger 的二进制补码表示形式的 byte 数组。
另请参见:
BigInteger(byte[])

--------------------------------------------------------------------------------

intValue
public int intValue()将此 BigInteger 转换为 int。此转换类似于 Java Language Specification 中定义的从 long 到 int 的基本收缩转换:如果此 BigInteger 太长而不适合用 int 表示,则仅返回 32 位的低位字节。注意,此转换会丢失关于该 BigInteger 值的总大小的信息,并返回带有相反符号的结果。

指定者:
类 Number 中的 intValue
返回:
转换为 int 的此 BigInteger。

--------------------------------------------------------------------------------

longValue
public long longValue()将此 BigInteger 转换为 long。此转换类似于 Java Language Specification 中定义的从 long 到 int 的基本收缩转换:如果此 BigInteger 太长而不适合用 long 表示,则仅返回 64 位的低位字节。注意,此转换会丢失关于该 BigInteger 值的总大小的信息,并返回带有相反符号的结果。

指定者:
类 Number 中的 longValue
返回:
转换为 long 的此 BigInteger。

--------------------------------------------------------------------------------

floatValue
public float floatValue()将此 BigInteger 转换为 float。此转换类似于 Java Language Specification 中定义的从 double 到 float 的基本收缩转换:如果此 BigInteger 的数量太大,不能表示为 float,则将其适当地转换为 Float.NEGATIVE_INFINITY 或 Float.POSITIVE_INFINITY。注意,即使在返回值是有限的情况下,此转换也可以丢失关于 BigInteger 值的精度的信息。

指定者:
类 Number 中的 floatValue
返回:
转换为 float 的此 BigInteger。

--------------------------------------------------------------------------------

doubleValue
public double doubleValue()将此 BigInteger 转换为 double。此转换类似于 Java Language Specification 中定义的从 double 到 float 的基本收缩转换:如果此 BigInteger 的数量太大,不能表示为 double,则将其适当地转换为 Double.NEGATIVE_INFINITY 或 Double.POSITIVE_INFINITY。注意,即使在返回值是有限的情况下,此转换也可以丢失关于 BigInteger 值的精度的信息。

BigDecimal也有类似的方法,具体见jdk1.6.

2. java.util.Arrays
static <T> List<T>
asList(T... a)
返回一个受指定数组支持的固定大小的列表。
static int binarySearch(byte[] a, byte key)
使用二分搜索法来搜索指定的 byte 型数组,以获得指定的值。
static int binarySearch(byte[] a, int fromIndex, int toIndex, byte key)
使用二分搜索法来搜索指定的 byte 型数组的范围,以获得指定的值。
static int binarySearch(char[] a, char key)
使用二分搜索法来搜索指定的 char 型数组,以获得指定的值。
static int binarySearch(char[] a, int fromIndex, int toIndex, char key)
使用二分搜索法来搜索指定的 char 型数组的范围,以获得指定的值。
static int binarySearch(double[] a, double key)
使用二分搜索法来搜索指定的 double 型数组,以获得指定的值。
static int binarySearch(double[] a, int fromIndex, int toIndex, double key)
使用二分搜索法来搜索指定的 double 型数组的范围,以获得指定的值。
static int binarySearch(float[] a, float key)
使用二分搜索法来搜索指定的 float 型数组,以获得指定的值。
static int binarySearch(float[] a, int fromIndex, int toIndex, float key)
使用二分搜索法来搜索指定的 float 型数组的范围,以获得指定的值。
static int binarySearch(int[] a, int key)
使用二分搜索法来搜索指定的 int 型数组,以获得指定的值。
static int binarySearch(int[] a, int fromIndex, int toIndex, int key)
使用二分搜索法来搜索指定的 int 型数组的范围,以获得指定的值。
static int binarySearch(long[] a, int fromIndex, int toIndex, long key)
使用二分搜索法来搜索指定的 long 型数组的范围,以获得指定的值。
static int binarySearch(long[] a, long key)
使用二分搜索法来搜索指定的 long 型数组,以获得指定的值。
static int binarySearch(Object[] a, int fromIndex, int toIndex, Object key)
使用二分搜索法来搜索指定数组的范围,以获得指定对象。
static int binarySearch(Object[] a, Object key)
使用二分搜索法来搜索指定数组,以获得指定对象。
static int binarySearch(short[] a, int fromIndex, int toIndex, short key)
使用二分搜索法来搜索指定的 short 型数组的范围,以获得指定的值。
static int binarySearch(short[] a, short key)
使用二分搜索法来搜索指定的 short 型数组,以获得指定的值。
static <T> int
binarySearch(T[] a, int fromIndex, int toIndex, T key, Comparator<? super T> c)
使用二分搜索法来搜索指定数组的范围,以获得指定对象。
static <T> int
binarySearch(T[] a, T key, Comparator<? super T> c)
使用二分搜索法来搜索指定数组,以获得指定对象。
static boolean[] copyOf(boolean[] original, int newLength)
复制指定的数组,截取或用 false 填充(如有必要),以使副本具有指定的长度。
static byte[] copyOf(byte[] original, int newLength)
复制指定的数组,截取或用 0 填充(如有必要),以使副本具有指定的长度。
static char[] copyOf(char[] original, int newLength)
复制指定的数组,截取或用 null 字符填充(如有必要),以使副本具有指定的长度。
static double[] copyOf(double[] original, int newLength)
复制指定的数组,截取或用 0 填充(如有必要),以使副本具有指定的长度。
static float[] copyOf(float[] original, int newLength)
复制指定的数组,截取或用 0 填充(如有必要),以使副本具有指定的长度。
static int[] copyOf(int[] original, int newLength)
复制指定的数组,截取或用 0 填充(如有必要),以使副本具有指定的长度。
static long[] copyOf(long[] original, int newLength)
复制指定的数组,截取或用 0 填充(如有必要),以使副本具有指定的长度。
static short[] copyOf(short[] original, int newLength)
复制指定的数组,截取或用 0 填充(如有必要),以使副本具有指定的长度。
static <T> T[]
copyOf(T[] original, int newLength)
复制指定的数组,截取或用 null 填充(如有必要),以使副本具有指定的长度。
static <T,U> T[]
copyOf(U[] original, int newLength, Class<? extends T[]> newType)
复制指定的数组,截取或用 null 填充(如有必要),以使副本具有指定的长度。
static boolean[] copyOfRange(boolean[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static byte[] copyOfRange(byte[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static char[] copyOfRange(char[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static double[] copyOfRange(double[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static float[] copyOfRange(float[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static int[] copyOfRange(int[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static long[] copyOfRange(long[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static short[] copyOfRange(short[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static <T> T[]
copyOfRange(T[] original, int from, int to)
将指定数组的指定范围复制到一个新数组。
static <T,U> T[]
copyOfRange(U[] original, int from, int to, Class<? extends T[]> newType)
将指定数组的指定范围复制到一个新数组。
static boolean deepEquals(Object[] a1, Object[] a2)
如果两个指定数组彼此是深层相等 的,则返回 true。
static int deepHashCode(Object[] a)
基于指定数组的“深层内容”返回哈希码。
static String deepToString(Object[] a)
返回指定数组“深层内容”的字符串表示形式。
static boolean equals(boolean[] a, boolean[] a2)
如果两个指定的 boolean 型数组彼此相等,则返回 true。
static boolean equals(byte[] a, byte[] a2)
如果两个指定的 byte 型数组彼此相等,则返回 true。
static boolean equals(char[] a, char[] a2)
如果两个指定的 char 型数组彼此相等,则返回 true。
static boolean equals(double[] a, double[] a2)
如果两个指定的 double 型数组彼此相等,则返回 true。
static boolean equals(float[] a, float[] a2)
如果两个指定的 float 型数组彼此相等,则返回 true。
static boolean equals(int[] a, int[] a2)
如果两个指定的 int 型数组彼此相等,则返回 true。
static boolean equals(long[] a, long[] a2)
如果两个指定的 long 型数组彼此相等,则返回 true。
static boolean equals(Object[] a, Object[] a2)
如果两个指定的 Objects 数组彼此相等,则返回 true。
static boolean equals(short[] a, short[] a2)
如果两个指定的 short 型数组彼此相等,则返回 true。
static void fill(boolean[] a, boolean val)
将指定的 boolean 值分配给指定 boolean 型数组的每个元素。
static void fill(boolean[] a, int fromIndex, int toIndex, boolean val)
将指定的 boolean 值分配给指定 boolean 型数组指定范围中的每个元素。
static void fill(byte[] a, byte val)
将指定的 byte 值分配给指定 byte 节型数组的每个元素。
static void fill(byte[] a, int fromIndex, int toIndex, byte val)
将指定的 byte 值分配给指定 byte 型数组指定范围中的每个元素。
static void fill(char[] a, char val)
将指定的 char 值分配给指定 char 型数组的每个元素。
static void fill(char[] a, int fromIndex, int toIndex, char val)
将指定的 char 值分配给指定 char 型数组指定范围中的每个元素。
static void fill(double[] a, double val)
将指定的 double 值分配给指定 double 型数组的每个元素。
static void fill(double[] a, int fromIndex, int toIndex, double val)
将指定的 double 值分配给指定 double 型数组指定范围中的每个元素。
static void fill(float[] a, float val)
将指定的 float 值分配给指定 float 型数组的每个元素。
static void fill(float[] a, int fromIndex, int toIndex, float val)
将指定的 float 值分配给指定 float 型数组指定范围中的每个元素。
static void fill(int[] a, int val)
将指定的 int 值分配给指定 int 型数组的每个元素。
static void fill(int[] a, int fromIndex, int toIndex, int val)
将指定的 int 值分配给指定 int 型数组指定范围中的每个元素。
static void fill(long[] a, int fromIndex, int toIndex, long val)
将指定的 long 值分配给指定 long 型数组指定范围中的每个元素。
static void fill(long[] a, long val)
将指定的 long 值分配给指定 long 型数组的每个元素。
static void fill(Object[] a, int fromIndex, int toIndex, Object val)
将指定的 Object 引用分配给指定 Object 数组指定范围中的每个元素。
static void fill(Object[] a, Object val)
将指定的 Object 引用分配给指定 Object 数组的每个元素。
static void fill(short[] a, int fromIndex, int toIndex, short val)
将指定的 short 值分配给指定 short 型数组指定范围中的每个元素。
static void fill(short[] a, short val)
将指定的 short 值分配给指定 short 型数组的每个元素。
static int hashCode(boolean[] a)
基于指定数组的内容返回哈希码。
static int hashCode(byte[] a)
基于指定数组的内容返回哈希码。
static int hashCode(char[] a)
基于指定数组的内容返回哈希码。
static int hashCode(double[] a)
基于指定数组的内容返回哈希码。
static int hashCode(float[] a)
基于指定数组的内容返回哈希码。
static int hashCode(int[] a)
基于指定数组的内容返回哈希码。
static int hashCode(long[] a)
基于指定数组的内容返回哈希码。
static int hashCode(Object[] a)
基于指定数组的内容返回哈希码。
static int hashCode(short[] a)
基于指定数组的内容返回哈希码。
static void sort(byte[] a)
对指定的 byte 型数组按数字升序进行排序。
static void sort(byte[] a, int fromIndex, int toIndex)
对指定 byte 型数组的指定范围按数字升序进行排序。
static void sort(char[] a)
对指定的 char 型数组按数字升序进行排序。
static void sort(char[] a, int fromIndex, int toIndex)
对指定 char 型数组的指定范围按数字升序进行排序。
static void sort(double[] a)
对指定的 double 型数组按数字升序进行排序。
static void sort(double[] a, int fromIndex, int toIndex)
对指定 double 型数组的指定范围按数字升序进行排序。
static void sort(float[] a)
对指定的 float 型数组按数字升序进行排序。
static void sort(float[] a, int fromIndex, int toIndex)
对指定 float 型数组的指定范围按数字升序进行排序。
static void sort(int[] a)
对指定的 int 型数组按数字升序进行排序。
static void sort(int[] a, int fromIndex, int toIndex)
对指定 int 型数组的指定范围按数字升序进行排序。
static void sort(long[] a)
对指定的 long 型数组按数字升序进行排序。
static void sort(long[] a, int fromIndex, int toIndex)
对指定 long 型数组的指定范围按数字升序进行排序。
static void sort(Object[] a)
根据元素的自然顺序对指定对象数组按升序进行排序。
static void sort(Object[] a, int fromIndex, int toIndex)
根据元素的自然顺序对指定对象数组的指定范围按升序进行排序。
static void sort(short[] a)
对指定的 short 型数组按数字升序进行排序。
static void sort(short[] a, int fromIndex, int toIndex)
对指定 short 型数组的指定范围按数字升序进行排序。
static <T> void
sort(T[] a, Comparator<? super T> c)
根据指定比较器产生的顺序对指定对象数组进行排序。
static <T> void
sort(T[] a, int fromIndex, int toIndex, Comparator<? super T> c)
根据指定比较器产生的顺序对指定对象数组的指定范围进行排序。
static String toString(boolean[] a)
返回指定数组内容的字符串表示形式。
static String toString(byte[] a)
返回指定数组内容的字符串表示形式。
static String toString(char[] a)
返回指定数组内容的字符串表示形式。
static String toString(double[] a)
返回指定数组内容的字符串表示形式。
static String toString(float[] a)
返回指定数组内容的字符串表示形式。
static String toString(int[] a)
返回指定数组内容的字符串表示形式。
static String toString(long[] a)
返回指定数组内容的字符串表示形式。
static String toString(Object[] a)
返回指定数组内容的字符串表示形式。
static String toString(short[] a)
返回指定数组内容的字符串表示形式。

3.java.lang.System
static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)
从指定源数组中复制一个数组,复制从指定的位置开始,到目标数组的指定位置结束。

4. java.lang.String
char charAt(int index)
返回指定索引处的 char 值。
int codePointAt(int index)
返回指定索引处的字符(Unicode 代码点)。
int codePointBefore(int index)
返回指定索引之前的字符(Unicode 代码点)。
int codePointCount(int beginIndex, int endIndex)
返回此 String 的指定文本范围中的 Unicode 代码点数。
int compareTo(String anotherString)
按字典顺序比较两个字符串。
int compareToIgnoreCase(String str)
按字典顺序比较两个字符串,不考虑大小写。
String concat(String str)
将指定字符串连接到此字符串的结尾。
boolean contains(CharSequence s)
当且仅当此字符串包含指定的 char 值序列时,返回 true。
boolean contentEquals(CharSequence cs)
将此字符串与指定的 CharSequence 比较。
boolean contentEquals(StringBuffer sb)
将此字符串与指定的 StringBuffer 比较。
static String copyValueOf(char[] data)
返回指定数组中表示该字符序列的 String。
static String copyValueOf(char[] data, int offset, int count)
返回指定数组中表示该字符序列的 String。
boolean endsWith(String suffix)
测试此字符串是否以指定的后缀结束。
boolean equals(Object anObject)
将此字符串与指定的对象比较。
boolean equalsIgnoreCase(String anotherString)
将此 String 与另一个 String 比较,不考虑大小写。
static String format(Locale l, String format, Object... args)
使用指定的语言环境、格式字符串和参数返回一个格式化字符串。
static String format(String format, Object... args)
使用指定的格式字符串和参数返回一个格式化字符串。
byte[] getBytes()
使用平台的默认字符集将此 String 编码为 byte 序列,并将结果存储到一个新的 byte 数组中。
byte[] getBytes(Charset charset)
使用给定的 charset 将此 String 编码到 byte 序列,并将结果存储到新的 byte 数组。
void getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin)
已过时。 该方法无法将字符正确转换为字节。从 JDK 1.1 起,完成该转换的首选方法是通过 getBytes() 方法,该方法使用平台的默认字符集。
byte[] getBytes(String charsetName)
使用指定的字符集将此 String 编码为 byte 序列,并将结果存储到一个新的 byte 数组中。
void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
将字符从此字符串复制到目标字符数组。
int hashCode()
返回此字符串的哈希码。
int indexOf(int ch)
返回指定字符在此字符串中第一次出现处的索引。
int indexOf(int ch, int fromIndex)
返回在此字符串中第一次出现指定字符处的索引,从指定的索引开始搜索。
int indexOf(String str)
返回指定子字符串在此字符串中第一次出现处的索引。
int indexOf(String str, int fromIndex)
返回指定子字符串在此字符串中第一次出现处的索引,从指定的索引开始。
String intern()
返回字符串对象的规范化表示形式。
boolean isEmpty()
当且仅当 length() 为 0 时返回 true。
int lastIndexOf(int ch)
返回指定字符在此字符串中最后一次出现处的索引。
int lastIndexOf(int ch, int fromIndex)
返回指定字符在此字符串中最后一次出现处的索引,从指定的索引处开始进行反向搜索。
int lastIndexOf(String str)
返回指定子字符串在此字符串中最右边出现处的索引。
int lastIndexOf(String str, int fromIndex)
返回指定子字符串在此字符串中最后一次出现处的索引,从指定的索引开始反向搜索。
int length()
返回此字符串的长度。
boolean matches(String regex)
告知此字符串是否匹配给定的正则表达式。
int offsetByCodePoints(int index, int codePointOffset)
返回此 String 中从给定的 index 处偏移 codePointOffset 个代码点的索引。
boolean regionMatches(boolean ignoreCase, int toffset, String other, int ooffset, int len)
测试两个字符串区域是否相等。
boolean regionMatches(int toffset, String other, int ooffset, int len)
测试两个字符串区域是否相等。
String replace(char oldChar, char newChar)
返回一个新的字符串,它是通过用 newChar 替换此字符串中出现的所有 oldChar 得到的。
String replace(CharSequence target, CharSequence replacement)
使用指定的字面值替换序列替换此字符串所有匹配字面值目标序列的子字符串。
String replaceAll(String regex, String replacement)
使用给定的 replacement 替换此字符串所有匹配给定的正则表达式的子字符串。
String replaceFirst(String regex, String replacement)
使用给定的 replacement 替换此字符串匹配给定的正则表达式的第一个子字符串。
String[] split(String regex)
根据给定正则表达式的匹配拆分此字符串。
String[] split(String regex, int limit)
根据匹配给定的正则表达式来拆分此字符串。
boolean startsWith(String prefix)
测试此字符串是否以指定的前缀开始。
boolean startsWith(String prefix, int toffset)
测试此字符串从指定索引开始的子字符串是否以指定前缀开始。
CharSequence subSequence(int beginIndex, int endIndex)
返回一个新的字符序列,它是此序列的一个子序列。
String substring(int beginIndex)
返回一个新的字符串,它是此字符串的一个子字符串。
String substring(int beginIndex, int endIndex)
返回一个新字符串,它是此字符串的一个子字符串。
char[] toCharArray()
将此字符串转换为一个新的字符数组。
String toLowerCase()
使用默认语言环境的规则将此 String 中的所有字符都转换为小写。
String toLowerCase(Locale locale)
使用给定 Locale 的规则将此 String 中的所有字符都转换为小写。
String toString()
返回此对象本身(它已经是一个字符串!)。
String toUpperCase()
使用默认语言环境的规则将此 String 中的所有字符都转换为大写。
String toUpperCase(Locale locale)
使用给定 Locale 的规则将此 String 中的所有字符都转换为大写。
String trim()
返回字符串的副本,忽略前导空白和尾部空白。
static String valueOf(boolean b)
返回 boolean 参数的字符串表示形式。
static String valueOf(char c)
返回 char 参数的字符串表示形式。
static String valueOf(char[] data)
返回 char 数组参数的字符串表示形式。
static String valueOf(char[] data, int offset, int count)
返回 char 数组参数的特定子数组的字符串表示形式。
static String valueOf(double d)
返回 double 参数的字符串表示形式。
static String valueOf(float f)
返回 float 参数的字符串表示形式。
static String valueOf(int i)
返回 int 参数的字符串表示形式。
static String valueOf(long l)
返回 long 参数的字符串表示形式。
static String valueOf(Object obj)
返回 Object 参数的字符串表示形式。



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: