public class NumberUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
NumberUtil.NumberFormatStyle |
| Constructor and Description |
|---|
NumberUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
amountInWords(BigDecimal amount)
Converts given amount to words with default decimal precision of 2.
|
static String |
formatNumber(BigDecimal number) |
static String |
formatNumber(BigDecimal number,
int fractionDigits,
boolean useGrouping)
Formats a given number with given number of fraction digits
e.g. |
static String |
formatNumber(BigDecimal number,
NumberUtil.NumberFormatStyle format) |
static String |
prefixZero(long value,
int paddingSize)
Prefix the given value with zero, if the value's length is less than given paddingSize
|
public static String amountInWords(BigDecimal amount)
amount - Amount to be converted to wordspublic static String formatNumber(BigDecimal number)
number - The number to be formattedpublic static String formatNumber(BigDecimal number, NumberUtil.NumberFormatStyle format)
number - Number to be formattedformat - NumberFormatStyle in which the number is to be formattedpublic static String formatNumber(BigDecimal number, int fractionDigits, boolean useGrouping)
number - The number to be formattedfractionDigits - Number of fraction digits to be used for formattinguseGrouping - Flag indicating whether grouping is to be used while formatting the numberpublic static String prefixZero(long value, int paddingSize)
value - the value applicable for paddingpaddingSize - the minimum padding size of the valueCopyright © 2015–2016 eGovernments Foundation. All rights reserved.