List of utility methods to do Fraction Format
String | formatNum(double num, int numfracdigits) format Num if (numberFormat == null) { numberFormat = NumberFormat.getInstance(); numberFormat.setGroupingUsed(false); numberFormat.setMinimumFractionDigits(numfracdigits); numberFormat.setMaximumFractionDigits(numfracdigits); return numberFormat.format(num); |
float | formatNum(float value) format Num DecimalFormat df1 = new DecimalFormat("###.00"); return Float.parseFloat(df1.format(value)); |
String | formatNumber(double decimal) format Number DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(); symbols.setGroupingSeparator(' '); symbols.setDecimalSeparator(','); DecimalFormat formatter = new DecimalFormat("###,###.###", symbols); formatter.setMaximumFractionDigits(3); formatter.setMinimumFractionDigits(3); return formatter.format(decimal); |
CharSequence | formatNumber(double i) format Number return NumberFormat.getInstance().format(i);
|
String | formatNumber(double num) Show a reasonable number of significant digits. double absnum = Math.abs(num); if (absnum == 0) { return "0"; if (absnum > 10000000.0 || absnum < 0.000000001) { return expFormat_.format(num); if (absnum > 1000.0) { ... |
String | formatNumber(double num) format Number return java.text.NumberFormat.getNumberInstance().format(num);
|
String | formatNumber(double number) format Number return formatNumber(number, "0.00"); |
String | formatNumber(double number) Formats a number, as a decimal number with at most 2 digits. return DECIMAL.format(number);
|
String | formatNumber(double number, int decimal) format Number NUM_FORMAT.setMaximumFractionDigits(decimal); NUM_FORMAT.setMinimumFractionDigits(decimal); return NUM_FORMAT.format(number).replace(",", ""); |
String | formatNumber(double number, int val) format Number NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(val); nf.setMinimumFractionDigits(val); nf.setRoundingMode(RoundingMode.HALF_UP); nf.setGroupingUsed(false); return nf.format(number); |