|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mpxj.utility.NumberUtility
public final class NumberUtility
This class contains utility methods for handling Number objects and numeric primitives.
| Field Summary | |
|---|---|
static Double |
DOUBLE_ZERO
|
| Constructor Summary | |
|---|---|
NumberUtility()
|
|
| Method Summary | |
|---|---|
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 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 |
truncate(double value,
double precision)
Utility method used to truncate a double to the given precision. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Double DOUBLE_ZERO
| Constructor Detail |
|---|
public NumberUtility()
| Method Detail |
|---|
public static final int getInt(Number value)
value - Number instance
public static final int getInt(String value)
value - string representation of an integer
public static final Integer getInteger(Number value)
value - Number instance
public static final Integer getInteger(String value)
value - String representation of an integer
public static final BigInteger getBigInteger(Number value)
value - Number instance
public static final double getDouble(Number value)
value - Number instance
public static final Double getDouble(double value)
value - Number instance
public static final double truncate(double value,
double precision)
value - value to truncateprecision - Number of decimals to truncate to.
public static final Integer parseInteger(String value)
value - string representation of an integer
public static boolean equals(Number lhs,
Number rhs)
lhs - left hand argumentrhs - right hand argument
public static boolean equals(double lhs,
double rhs,
double delta)
lhs - value to testrhs - value to testdelta - allowable difference
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||