public final class BigNumberUtil extends Object
Modifier and Type | Field and Description |
---|---|
static BigInteger |
BYTE_MAX |
static BigInteger |
BYTE_MIN |
static BigDecimal |
DOUBLE_MAX |
static BigDecimal |
DOUBLE_MIN |
static BigDecimal |
FLOAT_MAX |
static BigDecimal |
FLOAT_MIN |
static BigInteger |
INTEGER_MAX |
static BigInteger |
INTEGER_MIN |
static BigInteger |
LONG_MAX |
static BigInteger |
LONG_MIN |
static BigInteger |
SHORT_MAX |
static BigInteger |
SHORT_MIN |
Modifier and Type | Method and Description |
---|---|
static BigDecimal |
divide(BigDecimal bigNumerator,
BigDecimal bigDenominator)
Divides a BigDecimal by a BigDecimal.
|
static BigDecimal |
divide(BigDecimal bigNumerator,
BigDecimal bigDenominator,
MathContext context)
Divides a BigDecimal by a BigDecimal.
|
static BigDecimal |
divide(BigDecimal bigNumerator,
long denominator)
Divides a BigDecimal by a long while preserving scale.
|
static boolean |
isInByteRange(Number number)
Checks to see if a number is in the valid range for a Byte type.
|
static boolean |
isInDoubleRange(Number number)
Checks to see if a number is in the valid range for a Double type.
|
static boolean |
isInFloatRange(Number number)
Checks to see if a number is in the valid range for a Float type.
|
static boolean |
isInIntegerRange(Number number)
Checks to see if a number is in the valid range for a Integer type.
|
static boolean |
isInLongRange(Number number)
Checks to see if a number is in the valid range for a Long type.
|
static boolean |
isInRange(Number number,
BigDecimal min,
BigDecimal max)
Checks to see if a number is within the specified range.
|
static boolean |
isInRange(Number number,
BigInteger min,
BigInteger max)
Checks to see if a number is within the specified range.
|
static boolean |
isInShortRange(Number number)
Checks to see if a number is in the valid range for a Short type.
|
static BigDecimal |
remainder(BigDecimal bigNumerator,
BigDecimal bigDenominator)
Divides a BigDecimal by a BigDecimal and returns the remainder.
|
static BigDecimal |
remainder(BigDecimal bigNumerator,
BigDecimal bigDenominator,
MathContext context)
Divides a BigDecimal by a BigDecimal and returns the remainder.
|
static BigDecimal |
root(BigDecimal num,
int n,
MathContext baseMC)
Calculates the nth root of a BigDecimal.
|
static BigDecimal |
sqrt(BigDecimal num,
MathContext baseMC)
Calculates the square root of a BigDecimal.
|
public static final BigInteger BYTE_MIN
public static final BigInteger BYTE_MAX
public static final BigInteger SHORT_MIN
public static final BigInteger SHORT_MAX
public static final BigInteger INTEGER_MIN
public static final BigInteger INTEGER_MAX
public static final BigInteger LONG_MIN
public static final BigInteger LONG_MAX
public static final BigDecimal FLOAT_MIN
public static final BigDecimal FLOAT_MAX
public static final BigDecimal DOUBLE_MIN
public static final BigDecimal DOUBLE_MAX
public static boolean isInByteRange(Number number)
number
- the number to checkpublic static boolean isInShortRange(Number number)
number
- the number to checkpublic static boolean isInIntegerRange(Number number)
number
- the number to checkpublic static boolean isInLongRange(Number number)
number
- the number to checkpublic static boolean isInFloatRange(Number number)
number
- the number to checkpublic static boolean isInDoubleRange(Number number)
number
- the number to checkpublic static boolean isInRange(Number number, BigInteger min, BigInteger max)
number
- the number to checkmin
- the inclusive minimum of the rangemax
- the inclusive maximum of the rangepublic static boolean isInRange(Number number, BigDecimal min, BigDecimal max)
number
- the number to checkmin
- the inclusive minimum of the rangemax
- the inclusive maximum of the rangepublic static BigDecimal divide(BigDecimal bigNumerator, long denominator)
bigNumerator
- the BigDecimal to dividedenominator
- value to divide bypublic static BigDecimal divide(BigDecimal bigNumerator, BigDecimal bigDenominator)
bigNumerator
- the dividendbigDenominator
- the divisorpublic static BigDecimal divide(BigDecimal bigNumerator, BigDecimal bigDenominator, MathContext context)
bigNumerator
- the dividendbigDenominator
- the divisorcontext
- the context to usepublic static BigDecimal remainder(BigDecimal bigNumerator, BigDecimal bigDenominator)
bigNumerator
- the dividendbigDenominator
- the divisorpublic static BigDecimal remainder(BigDecimal bigNumerator, BigDecimal bigDenominator, MathContext context)
bigNumerator
- the dividendbigDenominator
- the divisorcontext
- the context to usepublic static BigDecimal sqrt(BigDecimal num, MathContext baseMC)
num
- a valuebaseMC
- the math context to usepublic static BigDecimal root(BigDecimal num, int n, MathContext baseMC)
num
- a valuen
- the rootbaseMC
- the math context to useCopyright © 2021 Actian Corporation. All rights reserved.