List of utility methods to do Number Format
String | numberFormat(double value, String format) number Format DecimalFormat objDecimalFormat = new DecimalFormat(format); return objDecimalFormat.format(value); |
NumberFormat | numberFormat(int fractionDigits, Locale locale) number Format NumberFormat nf = NumberFormat.getInstance(locale);
nf.setMinimumFractionDigits(fractionDigits);
nf.setMaximumFractionDigits(fractionDigits);
return nf;
|
String | numberFormat(int i) number Format return NF.format(i);
|
String | numberFormat(int num) number Format NumberFormat nf = NumberFormat.getInstance();
return nf.format(num);
|
String | numberFormat(Number number, String... pattern) number Format return isNull((Object[]) pattern) ? FORMAT.format(number) : FORMAT.format(pattern[0]);
|
String | numberFormat(String pattern, BigDecimal number) number Format String numberStr = null; if (number == null) { return ""; try { if (pattern == null || pattern.equals("")) { numberStr = new DecimalFormat("#0.00##").format(number.doubleValue()); } else { ... |
String | numberFormat(String pattern, double value) Returns an text with the value formatted. DecimalFormat myFormatter = new DecimalFormat(pattern); return myFormatter.format(value); |
int | numberFormate(double num) number Formate DecimalFormat df = new DecimalFormat("#####0"); String formatNum = df.format(num); return Integer.parseInt(formatNum); |
String | numberFormatHelper(String string, double d) number Format Helper if (d == (int) d) { return String.format(string + " %d", (int) d); } else { return String.format(string + " %s", new DecimalFormat("#.##").format(d)); |
DecimalFormat | numberFormatter(String pattern, int maxDigits) number Formatter DecimalFormat f = new DecimalFormat(pattern ); f.setMaximumFractionDigits(maxDigits); return f; |