Guava BigIntegerMath 工具类
BigIntegerMath 提供 BigInteger 的实用方法。
一、类声明
以下是 com.google.common.math.BigIntegerMath 类的声明:
@GwtCompatible(emulated=true) public final class BigIntegerMath extends Object
二、类方法
| 修饰符和类型 | 方法说明 | 
|---|---|
static BigInteger | binomial(int n, int k) 返回n选择k,也称为n和k的二项式系数,即 n! / (k! (n - k)!).  | 
static BigInteger | ceilingPowerOfTwo(BigInteger x) 返回大于或等于x的最小2的幂.  | 
static BigInteger | divide(BigInteger p, BigInteger q, RoundingMode mode) 返回将p除以q的结果,使用指定的RoundingMode进行舍入.  | 
static BigInteger | factorial(int n) 返回n!,即前n个正整数的乘积,如果n==0,则返回1.  | 
static BigInteger | floorPowerOfTwo(BigInteger x) 返回小于或等于x的最大2的幂.  | 
static boolean | isPowerOfTwo(BigInteger x) 如果x表示2的幂,则返回true。  | 
static int | log10(BigInteger x, RoundingMode mode) 返回10的对数,根据指定的舍入模式进行舍入.  | 
static int | log2(BigInteger x, RoundingMode mode) 返回2的对数,根据指定的舍入模式进行舍入.  | 
static BigInteger | sqrt(BigInteger x, RoundingMode mode) 返回x的平方根,使用指定的舍入模式进行舍入.  | 
三、测试类
BigIntegerMath 用于对 BigInteger 类型执行数学运算。此实用程序有一些类似于 IntMath 的方法。
四、相关文章
未经允许请勿转载:程序喵 » Google Guava 快速入门 —— 【数学运算工具】BigIntegerMath 类
程序喵