Example usage for Java org.apache.commons.lang.math NumberUtils fields, constructors, methods, implement or subclass
The text is from its open source code.
Long | LONG_ZERO Reusable Long constant for zero. |
Long | LONG_ONE Reusable Long constant for one. |
Integer | INTEGER_ZERO Reusable Integer constant for zero. |
Integer | INTEGER_ONE Reusable Integer constant for one. |
Integer | INTEGER_MINUS_ONE Reusable Integer constant for minus one. |
Short | SHORT_ZERO Reusable Short constant for zero. |
Double | DOUBLE_ZERO Reusable Double constant for zero. |
Float | FLOAT_ZERO Reusable Float constant for zero. |
NumberUtils()
|
int | compare(double lhs, double rhs) Compares two This method is more comprehensive than the standard Java greater than, less than and equals operators.
The ordering is as follows, largest to smallest:
Comparing |
int | compare(float lhs, float rhs) Compares two floats for order. This method is more comprehensive than the standard Java greater than, less than and equals operators.
|
BigDecimal | createBigDecimal(String str) Convert a Returns |
BigInteger | createBigInteger(String str) Convert a Returns |
Double | createDouble(String str) Convert a Returns |
Float | createFloat(String str) Convert a Returns |
Integer | createInteger(String str) Convert a Returns |
Long | createLong(String str) Convert a Returns |
Number | createNumber(String str) Turns a string value into a java.lang.Number. First, the value is examined for a type qualifier on the end ( |
boolean | isDigits(String str) Checks whether the
|
boolean | isNumber(String str) Checks whether the String a valid Java number. Valid numbers include hexadecimal marked with the |
long | max(long[] array) Returns the maximum value in an array. |
int | max(int[] array) Returns the maximum value in an array. |
short | max(short[] array) Returns the maximum value in an array. |
byte | max(byte[] array) Returns the maximum value in an array. |
double | max(double[] array) Returns the maximum value in an array. |
float | max(float[] array) Returns the maximum value in an array. |
long | max(long a, long b, long c) Gets the maximum of three |
int | max(int a, int b, int c) Gets the maximum of three |
short | max(short a, short b, short c) Gets the maximum of three |
byte | max(byte a, byte b, byte c) Gets the maximum of three |
double | max(double a, double b, double c) Gets the maximum of three If any value is |
float | max(float a, float b, float c) Gets the maximum of three If any value is |
long | min(long[] array) Returns the minimum value in an array. |
int | min(int[] array) Returns the minimum value in an array. |
short | min(short[] array) Returns the minimum value in an array. |
byte | min(byte[] array) Returns the minimum value in an array. |
double | min(double[] array) Returns the minimum value in an array. |
float | min(float[] array) Returns the minimum value in an array. |
long | min(long a, long b, long c) Gets the minimum of three |
int | min(int a, int b, int c) Gets the minimum of three |
short | min(short a, short b, short c) Gets the minimum of three |
byte | min(byte a, byte b, byte c) Gets the minimum of three |
double | min(double a, double b, double c) Gets the minimum of three If any value is |
float | min(float a, float b, float c) Gets the minimum of three If any value is |
int | stringToInt(String str) Convert a If the string is NumberUtils.stringToInt(null) = 0 NumberUtils.stringToInt("") = 0 NumberUtils.stringToInt("1") = 1 |
int | stringToInt(String str, int defaultValue) Convert a If the string is NumberUtils.stringToInt(null, 1) = 1 NumberUtils.stringToInt("", 1) = 1 NumberUtils.stringToInt("1", 0) = 1 |
double | toDouble(String str, double defaultValue) Convert a If the string NumberUtils.toDouble(null, 1.1d) = 1.1d NumberUtils.toDouble("", 1.1d) = 1.1d NumberUtils.toDouble("1.5", 0.0d) = 1.5d |
double | toDouble(String str) Convert a If the string NumberUtils.toDouble(null) = 0.0d NumberUtils.toDouble("") = 0.0d NumberUtils.toDouble("1.5") = 1.5d |
float | toFloat(String str) Convert a If the string NumberUtils.toFloat(null) = 0.0f NumberUtils.toFloat("") = 0.0f NumberUtils.toFloat("1.5") = 1.5f |
float | toFloat(String str, float defaultValue) Convert a If the string NumberUtils.toFloat(null, 1.1f) = 1.0f NumberUtils.toFloat("", 1.1f) = 1.1f NumberUtils.toFloat("1.5", 0.0f) = 1.5f |
int | toInt(String str, int defaultValue) Convert a If the string is NumberUtils.toInt(null, 1) = 1 NumberUtils.toInt("", 1) = 1 NumberUtils.toInt("1", 0) = 1 |
int | toInt(String str) Convert a If the string is NumberUtils.toInt(null) = 0 NumberUtils.toInt("") = 0 NumberUtils.toInt("1") = 1 |
long | toLong(String str) Convert a If the string is NumberUtils.toLong(null) = 0L NumberUtils.toLong("") = 0L NumberUtils.toLong("1") = 1L |
long | toLong(String str, long defaultValue) Convert a If the string is NumberUtils.toLong(null, 1L) = 1L NumberUtils.toLong("", 1L) = 1L NumberUtils.toLong("1", 0L) = 1L |