List of utility methods to do Fraction Format
String | formatIndexValuePairs(List format Index Value Pairs DecimalFormat formatter = new DecimalFormat("#,##0.#"); StringBuilder builder = new StringBuilder(); int startRange = 0; int previousIndex = 0; double rangeValue = 0; for (int i = 0; i < indicies.size(); i++) { int index = indicies.get(i); double value = values.get(i); ... |
String | formatInt(double value) Formats a specified numeric value as int. return INT_FORMAT.format(value);
|
String | formatIntoCurr(double num, int digits) Use this method like this: String formatted = Util.formatIntoCurr(123456789.123, 2); formatted ==> "123,456,789.12" return formatIntoCurr("" + num, digits); |
String | formatIntRate(double rateInt) format Int Rate try { NumberFormat nf = new DecimalFormat("0.00"); String moneyValue = nf.format(rateInt * 100); return moneyValue + "%"; } catch (Exception ex) { return ""; |
String | formatKnots(double v) format Knots return new DecimalFormat(FORMAT_SHORT).format(toKnots(v)) + " " + UNIT_KNOTS; |
String | formatManeyPattern(String pattern, Double amount) format Maney Pattern NumberFormat nf = new DecimalFormat(pattern); return nf.format(amount); |
String | formatMetricsDecimal(double value) format Metrics Decimal if (value == -1 || Double.isNaN(value) || Double.isInfinite(value)) { return NO_METRICS_LABEL; } else { return getDecimalFormatter().format(value); |
String | formatNoGrouping(double value) format No Grouping NumberFormat groupedFormat = NumberFormat.getNumberInstance();
groupedFormat.setGroupingUsed(false);
return groupedFormat.format(value);
|
String | formatNormalDouble(double value) format Normal Double String formattedDouble = formatDouble(value, "0.000"); return formattedDouble; |
String | formatNum(double d) format Num DecimalFormat df = new DecimalFormat("####,##0.00"); String result = df.format(d); if (".00".equals(result)) { result = "0" + result; return result; |