List of utility methods to do Fraction Format
double | formatDouble(double orig) format Double DecimalFormat df = new DecimalFormat("######0.000"); return Double.valueOf(df.format(orig)).doubleValue(); |
String | formatDouble(Double someDouble) Formats a double as a string with a default number of significant digits depending on the argument's value. return formatDouble(someDouble, false);
|
String | formatDouble(Double v) format Double try { DecimalFormat df = new DecimalFormat(); df.setGroupingUsed(false); df.setMaximumFractionDigits(12); return df.format(v); } catch (java.lang.IllegalArgumentException e) { return v.toString(); |
String | formatDouble(double value) format Double return formatter.format(value);
|
String | formatDouble(double value) format Double return Double.isNaN(value) ? "NaN" : _decimalFormat.format(value); |
String | formatDouble(double value, int precision) Returns a formatted Double value given a specific DecimalFormat If more than 4 integer, then we display the value in scientific notation String result; if (((int) value) > 9999 || ((int) value) < -9999) { result = new DecimalFormat("0.######E0").format(value); } else result = String.valueOf(roundDouble(value, precision)); return result == null ? "-" : result; |
java.lang.String | FormatDouble(final double dblValue, final int iNumLeft, final int iNumRight, final double dblMultiplier) Format the double input by multiplying, and then adding left and right adjustments java.lang.String strFormat = "#"; for (int i = 0; i < iNumLeft; ++i) strFormat += "0"; if (0 != iNumRight) { strFormat += "."; for (int i = 0; i < iNumRight; ++i) strFormat += "0"; return new java.text.DecimalFormat(strFormat).format(dblMultiplier * dblValue); |
String | formatDouble(Object obj) format Double DecimalFormat fmt = new DecimalFormat("#,##0.00"); String str = String.valueOf(obj); if (obj instanceof Double) { return fmt.format(obj); } else if (str.matches("^[-\\+]?\\d+(\\.\\d+)?$")) { return fmt.format(Double.valueOf(str)); } else { return toStringWithOutNull(str); ... |
String | formatDouble(Object value) format Double NumberFormat doubleFormat = NumberFormat.getNumberInstance();
return doubleFormat.format(((Number) value).doubleValue());
|
String | formatDoubleAmount(double amount) Formats the given double as a dollar amount, with negative amounts in parentheses. NumberFormat formatter = new DecimalFormat("$#,###,##0.00;($#,###,##0.00)"); return formatter.format(amount); |