public final class NumberTools extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
bigDecimalToString(BigDecimal value,
Locale locale,
int minFractionDigit,
int maxFractionDigit,
int maxIntegerDigit)
Give the string representation of a big decimal
|
static String |
doubleToString(Double value,
Locale locale,
int minFractionDigit,
int maxFractionDigit)
Give the string representation of a double
|
static <N extends Number> |
nullIfZero(N n)
Returns null if the value if zero
|
static BigDecimal |
parseBigDecimal(String value,
Locale locale,
int maxFractionDigit,
int maxIntegerDigit)
Parse a big decimal from a String.
|
static Double |
parseDouble(String value,
Locale locale,
int maxFractionDigit)
Parse a double from a String.
|
public static <N extends Number> N nullIfZero(N n)
N - Number typen - Number valuepublic static Double parseDouble(String value, Locale locale, int maxFractionDigit)
value - String value to parselocale - The locale which define the decimal separatormaxFractionDigit - The maximum number of digits allowed in the fraction portionpublic static BigDecimal parseBigDecimal(String value, Locale locale, int maxFractionDigit, int maxIntegerDigit)
value - String value to parselocale - The locale which define the decimal separatormaxFractionDigit - The maximum number of digits allowed in the fraction portionmaxIntegerDigit - The maximum number of digits allowed in the integer portionpublic static String doubleToString(Double value, Locale locale, int minFractionDigit, int maxFractionDigit)
value - The doublelocale - The locale which define the decimal separatorminFractionDigit - the minimum number of digits allowed in the fraction portionmaxFractionDigit - The maximum number of digits allowed in the fraction portionpublic static String bigDecimalToString(BigDecimal value, Locale locale, int minFractionDigit, int maxFractionDigit, int maxIntegerDigit)
value - The big decimallocale - The locale which define the decimal separatorminFractionDigit - the minimum number of digits allowed in the fraction portionmaxFractionDigit - The maximum number of digits allowed in the fraction portionmaxIntegerDigit - The maximum number of digits allowed in the integer portionCopyright © 2009–2014 IRD. All rights reserved.