Java org.apache.commons.lang3.math NumberUtils fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.lang3.math NumberUtils fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.lang3.math NumberUtils.

The text is from its open source code.

Subclass

org.apache.commons.lang3.math.NumberUtils has subclasses.
Click this link to see all its subclasses.

Field

LongLONG_ZERO
Reusable Long constant for zero.
LongLONG_ONE
Reusable Long constant for one.
IntegerINTEGER_ZERO
Reusable Integer constant for zero.
IntegerINTEGER_ONE
Reusable Integer constant for one.
ShortSHORT_ZERO
Reusable Short constant for zero.
ByteBYTE_ZERO
Reusable Byte constant for zero.

Method

BigDecimalcreateBigDecimal(final String str)

Convert a String to a BigDecimal.

Returns null if the string is null.

DoublecreateDouble(final String str)

Convert a String to a Double.

Returns null if the string is null.

FloatcreateFloat(final String str)

Convert a String to a Float.

Returns null if the string is null.

IntegercreateInteger(final String str)

Convert a String to a Integer, handling hex (0xhhhh) and octal (0dddd) notations.

LongcreateLong(final String str)

Convert a String to a Long; since 3.1 it handles hex (0Xhhhh) and octal (0ddd) notations.

NumbercreateNumber(final String str)

Turns a string value into a java.lang.Number.

If the string starts with 0x or -0x (lower or upper case) or # or -# , it will be interpreted as a hexadecimal Integer - or Long, if the number of digits after the prefix is more than 8 - or BigInteger if there are more than 16 digits.

booleanisDigits(final String str)

Checks whether the String contains only digit characters.

Null and empty String will return false.

booleanisNumber(final String str)

Checks whether the String a valid Java number.

Valid numbers include hexadecimal marked with the 0x or 0X qualifier, octal numbers, scientific notation and numbers marked with a type qualifier (e.g.

booleanisParsable(final String str)

Checks whether the given String is a parsable number.

Parsable numbers include those Strings understood by Integer#parseInt(String) , Long#parseLong(String) , Float#parseFloat(String) or Double#parseDouble(String) .

longmax(final long... array)

Returns the maximum value in an array.

intmax(final int... array)

Returns the maximum value in an array.

shortmax(final short... array)

Returns the maximum value in an array.

bytemax(final byte... array)

Returns the maximum value in an array.

doublemax(final double... array)

Returns the maximum value in an array.

floatmax(final float... array)

Returns the maximum value in an array.

longmax(long a, final long b, final long c)

Gets the maximum of three long values.

intmax(int a, final int b, final int c)

Gets the maximum of three int values.

shortmax(short a, final short b, final short c)

Gets the maximum of three short values.

bytemax(byte a, final byte b, final byte c)

Gets the maximum of three byte values.

doublemax(final double a, final double b, final double c)

Gets the maximum of three double values.

If any value is NaN, NaN is returned.

floatmax(final float a, final float b, final float c)

Gets the maximum of three float values.

If any value is NaN, NaN is returned.

longmin(long a, final long b, final long c)

Gets the minimum of three long values.

intmin(int a, final int b, final int c)

Gets the minimum of three int values.

shortmin(short a, final short b, final short c)

Gets the minimum of three short values.

bytemin(byte a, final byte b, final byte c)

Gets the minimum of three byte values.

doublemin(final double a, final double b, final double c)

Gets the minimum of three double values.

If any value is NaN, NaN is returned.

floatmin(final float a, final float b, final float c)

Gets the minimum of three float values.

If any value is NaN, NaN is returned.

longmin(final long... array)

Returns the minimum value in an array.

intmin(final int... array)

Returns the minimum value in an array.

shortmin(final short... array)

Returns the minimum value in an array.

bytemin(final byte... array)

Returns the minimum value in an array.

doublemin(final double... array)

Returns the minimum value in an array.

floatmin(final float... array)

Returns the minimum value in an array.

bytetoByte(final String str)

Convert a String to a byte, returning zero if the conversion fails.

If the string is null, zero is returned.

 NumberUtils.toByte(null) = 0 NumberUtils.toByte("")   = 0 NumberUtils.toByte("1")  = 1 
doubletoDouble(final String str)

Convert a String to a double, returning 0.0d if the conversion fails.

If the string str is null, 0.0d is returned.

 NumberUtils.toDouble(null)   = 0.0d NumberUtils.toDouble("")     = 0.0d NumberUtils.toDouble("1.5")  = 1.5d 
doubletoDouble(final String str, final double defaultValue)

Convert a String to a double, returning a default value if the conversion fails.

If the string str is null, the default value is returned.

 NumberUtils.toDouble(null, 1.1d)   = 1.1d NumberUtils.toDouble("", 1.1d)     = 1.1d NumberUtils.toDouble("1.5", 0.0d)  = 1.5d 
floattoFloat(final String str)

Convert a String to a float, returning 0.0f if the conversion fails.

If the string str is null, 0.0f is returned.

 NumberUtils.toFloat(null)   = 0.0f NumberUtils.toFloat("")     = 0.0f NumberUtils.toFloat("1.5")  = 1.5f 
floattoFloat(final String str, final float defaultValue)

Convert a String to a float, returning a default value if the conversion fails.

If the string str is null, the default value is returned.

 NumberUtils.toFloat(null, 1.1f)   = 1.0f NumberUtils.toFloat("", 1.1f)     = 1.1f NumberUtils.toFloat("1.5", 0.0f)  = 1.5f 
inttoInt(final String str, final int defaultValue)

Convert a String to an int, returning a default value if the conversion fails.

If the string is null, the default value is returned.

 NumberUtils.toInt(null, 1) = 1 NumberUtils.toInt("", 1)   = 1 NumberUtils.toInt("1", 0)  = 1 
inttoInt(final String str)

Convert a String to an int, returning zero if the conversion fails.

If the string is null, zero is returned.

 NumberUtils.toInt(null) = 0 NumberUtils.toInt("")   = 0 NumberUtils.toInt("1")  = 1 
longtoLong(final String str, final long defaultValue)

Convert a String to a long, returning a default value if the conversion fails.

If the string is null, the default value is returned.

 NumberUtils.toLong(null, 1L) = 1L NumberUtils.toLong("", 1L)   = 1L NumberUtils.toLong("1", 0L)  = 1L 
longtoLong(final String str)

Convert a String to a long, returning zero if the conversion fails.

If the string is null, zero is returned.

 NumberUtils.toLong(null) = 0L NumberUtils.toLong("")   = 0L NumberUtils.toLong("1")  = 1L 
shorttoShort(final String str)

Convert a String to a short, returning zero if the conversion fails.

If the string is null, zero is returned.

 NumberUtils.toShort(null) = 0 NumberUtils.toShort("")   = 0 NumberUtils.toShort("1")  = 1 
shorttoShort(final String str, final short defaultValue)

Convert a String to an short, returning a default value if the conversion fails.

If the string is null, the default value is returned.

 NumberUtils.toShort(null, 1) = 1 NumberUtils.toShort("", 1)   = 1 NumberUtils.toShort("1", 0)  = 1