List of utility methods to do Number Format Pattern
String | format(final long l) Formats a number. final StringBuffer s = new StringBuffer(); return FORMAT_LONG.format(l, s, new java.text.FieldPosition(0)).toString(); |
String | format(final long value, final long divider, final String unit) format final double result = divider > 1 ? (double) value / (double) divider : (double) value; return new DecimalFormat("#,##0.#").format(result) + " " + unit; |
String | format(Integer num) format String result = ""; try { result = format((double) num); } catch (Exception e) { return result; |
String | format(long bytes) format double val = bytes; int mag = 0; while (val > 1024) { val = val / 1024; mag++; String formatted = MEM_FMT.format(val); switch (mag) { ... |
String | format(long value) format return format.format(value);
|
String | format(Number value) format return format(value, DEFAULT_NUMBER_FORMAT);
|
String | format(Number value) format return format(value, DEFAULT_PATTERN);
|
String | format(Object num, int dev, String valueIfZero) format if (num == null) { return valueIfZero; if (dev == 0) { dev = 1; double f = Double.parseDouble(num.toString()); f = f / dev; ... |
String | format(Object price) format DecimalFormat formatter = new DecimalFormat("###,###,##0.00"); return formatter.format(price); |
double | format(String str_number, int digits) relation fuction to Currency format String formatted = Util.format("1234.67789", 2); formatted ==> "1234.68" String pattern = "###."; double value = -1.; for (int i = 0; i < digits; i++) { pattern += "#"; try { value = Double.parseDouble(str_number); } catch (NumberFormatException e) { ... |