| Constructor and Description |
|---|
Numbers() |
| Modifier and Type | Method and Description |
|---|---|
static Number |
add(Number a,
Number b)
Return the sum of two numbers.
|
static boolean |
areEqual(Number a,
Number b)
Return
true if a is mathematically equal to b. |
static boolean |
areEqualCastSafe(Object a,
Object b)
Perform a cast safe equality check for two objects.
|
static int |
compare(Number a,
Number b)
Compare
a to b. |
static Number |
divide(Number a,
Number b)
Return the division of two numbers.
|
static Number |
incrementalAverage(Number running,
Number number,
int count)
Compute the incremental average from the current
running of the
same, given the latest number and the total count of
items (including the specified number). |
static boolean |
isEqualTo(Number a,
Number b)
Deprecated.
Deprecated in version 0.7. Use
areEqual(Number, Number) instead. |
static boolean |
isEqualToCastSafe(Object a,
Object b)
Deprecated.
Deprecated in version 0.7. Use
#areEqualCastSafe(Number, Number) instead. |
static boolean |
isEven(Number number)
Return
true if number is evenly divisible by two. |
static boolean |
isFloatingPoint(Number number)
Return
true if the number is a floating point type. |
static boolean |
isGreaterThan(Number a,
Number b)
Return
true if a is mathematically greater than b |
static boolean |
isGreaterThanOrEqualTo(Number a,
Number b)
Return
true if a is mathematically greater than or equal
to b. |
static boolean |
isLessThan(Number a,
Number b)
Return
true if a is mathematically less than b. |
static boolean |
isLessThanOrEqualTo(Number a,
Number b)
Return
true if a is mathematically less than or equal to
b. |
static boolean |
isOdd(Number number)
Return
true if number is not evenly divisible by two. |
static Number |
max(Number... numbers)
Return the max from a list of
numbers. |
static Number |
min(Number... numbers)
Return the min from a list of
numbers. |
static Number |
multiply(Number a,
Number b)
Return the product of two numbers.
|
static double |
percent(Number numerator,
Number denominator)
Return numerator/denominator as a percent.
|
static double |
round(Number value,
int places)
Round the numeric
value to places without truncating. |
static Number |
scale(Number number,
Number rawMin,
Number rawMax,
Number scaledMin,
Number scaledMax)
Scale
number, which is between rawMin and rawMax
to a value between scaledMin and scaleMax. |
static BigDecimal |
toBigDecimal(Number number)
Checks the instance type of input
Number and returns a
corresponding BigDecimal. |
public static int compare(Number a, Number b)
a to b.a - b - a is numerically less than, equal to, or
greater than b.public static Number incrementalAverage(Number running, Number number, int count)
running of the
same, given the latest number and the total count of
items (including the specified number).running - the running averagenumber - the next number to include in the averagecount - the total number of items, including the specified
number that contribute to the averagepublic static boolean areEqual(Number a, Number b)
true if a is mathematically equal to b.a - b - true if a == b@Deprecated public static boolean isEqualTo(Number a, Number b)
areEqual(Number, Number) instead.true if a is mathematically equal to b.a - b - true if a == bpublic static boolean areEqualCastSafe(Object a, Object b)
If both objects are instances of the Number class, this method
will behave the same was as isEqualTo(Number, Number).
Otherwise, this method returns false.
@Deprecated public static boolean isEqualToCastSafe(Object a, Object b)
#areEqualCastSafe(Number, Number) instead.
If both objects are instances of the Number class, this method
will behave the same was as isEqualTo(Number, Number).
Otherwise, this method returns false.
public static boolean isEven(Number number)
true if number is evenly divisible by two.number - true if number is even.public static boolean isFloatingPoint(Number number)
true if the number is a floating point type.public static boolean isGreaterThan(Number a, Number b)
true if a is mathematically greater than ba - b - true if a > bpublic static boolean isGreaterThanOrEqualTo(Number a, Number b)
true if a is mathematically greater than or equal
to b.a - b - true if a >= bpublic static boolean isLessThan(Number a, Number b)
true if a is mathematically less than b.a - b - true if a < bpublic static boolean isLessThanOrEqualTo(Number a, Number b)
true if a is mathematically less than or equal to
b.a - b - true if a <= bpublic static boolean isOdd(Number number)
true if number is not evenly divisible by two.number - true if number is odd.public static Number max(Number... numbers)
numbers.numbers - public static Number min(Number... numbers)
numbers.numbers - public static double percent(Number numerator, Number denominator)
numerator - denominator - public static double round(Number value, int places)
value to places without truncating.value - the number to roundplaces - the max number of decimal placespublic static Number scale(Number number, Number rawMin, Number rawMax, Number scaledMin, Number scaledMax)
number, which is between rawMin and rawMax
to a value between scaledMin and scaleMax.number - rawMin - rawMax - scaledMin - scaledMax - public static BigDecimal toBigDecimal(Number number)
Number and returns a
corresponding BigDecimal.number - BigDecimal