public final class NumberHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static Double |
DOUBLE_ONEHUNDRED |
static Double |
DOUBLE_ZERO |
| Constructor and Description |
|---|
NumberHelper() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(Integer n1,
Integer n2)
Compare two integers, accounting for null values.
|
static boolean |
equals(double lhs,
double rhs,
double delta)
Compares two doubles for equality, within an allowable range
of difference.
|
static boolean |
equals(Number lhs,
Number rhs)
This method is used to compare two numbers.
|
static BigInteger |
getBigInteger(Number value)
Utility method used to convert a Number into a BigInteger.
|
static Double |
getDouble(double value)
Utility method used to convert a double into a Double.
|
static double |
getDouble(Number value)
Utility method used to convert a Number into a double.
|
static double |
getDouble(String value)
This method retrieves a double value from a String instance.
|
static Double |
getDoubleObject(String value)
This method retrieves a double value from a String instance.
|
static int |
getInt(Number value)
This method retrieves an int value from a Number instance.
|
static int |
getInt(String value)
This method retrieves an int value from a String instance.
|
static Integer |
getInteger(Number value)
Utility method used to convert an arbitrary Number into an Integer.
|
static Integer |
getInteger(String value)
Converts a string representation of an integer into an Integer object.
|
static Integer |
parseInteger(String value)
Utility method to convert a String to an Integer, and
handles null values.
|
static double |
round(double value,
double precision)
Utility method used to round a double to the given precision.
|
static Double |
sumAsDouble(Number... values)
Calculate the sum of a list of numbers and express the result as a Double instance.
|
public static final Double DOUBLE_ZERO
public static final Double DOUBLE_ONEHUNDRED
public static final int getInt(Number value)
value - Number instancepublic static final int getInt(String value)
value - string representation of an integerpublic static final double getDouble(String value)
value - string representation of a doublepublic static final Double getDoubleObject(String value)
value - string representation of a doublepublic static final Integer getInteger(Number value)
value - Number instancepublic static final Integer getInteger(String value)
value - String representation of an integerpublic static final BigInteger getBigInteger(Number value)
value - Number instancepublic static final double getDouble(Number value)
value - Number instancepublic static final Double getDouble(double value)
value - Number instancepublic static final double round(double value,
double precision)
value - value to truncateprecision - Number of decimals to round to.public static final Integer parseInteger(String value)
value - string representation of an integerpublic static boolean equals(Number lhs, Number rhs)
lhs - left hand argumentrhs - right hand argumentpublic static int compare(Integer n1, Integer n2)
n1 - integer valuen2 - integer valuepublic static boolean equals(double lhs,
double rhs,
double delta)
lhs - value to testrhs - value to testdelta - allowable differenceCopyright © 2000–2026 MPXJ. All rights reserved.