List of utility methods to do Double Number to String
String | doubleToString(double value, int afterDecimalPoint) Rounds a double and converts it into String. DF.get().setMaximumFractionDigits(afterDecimalPoint);
return DF.get().format(value);
|
String | doubleToString(double value, int fractionDigits) double To String return doubleToString(value, 0, fractionDigits);
|
String | doubleToString(double value, int maximum, int minimum) double To String NumberFormat nbf;
nbf = NumberFormat.getNumberInstance();
nbf.setMaximumFractionDigits(maximum);
nbf.setMinimumFractionDigits(minimum);
nbf.setGroupingUsed(false);
return nbf.format(value);
|
String | doubleToString(double value, String format) Converts a double to a string. return new DecimalFormat(format).format(value); |
String | doubleToString(final double d, final int decimalPlaces) double To String String dec = ""; for (int i = 0; i < decimalPlaces; i++) { dec = dec + "#"; final DecimalFormat df = new DecimalFormat("#." + dec); return df.format(d); |
String | doubleToString(final double number) double To String final double abs = Math.abs(number); final DecimalFormat format; if (abs < 100.0) { format = new DecimalFormat("#.#####"); } else if (abs < 1000.0) { format = new DecimalFormat("#.####"); } else if (abs < 10000.0) { format = new DecimalFormat("#.###"); ... |
String | doubleToSz(double dval) Converts double into a formatted string representation String szexp; double dtempval = dval; int nexp = 0; NumberFormat nf2 = NumberFormat.getInstance(Locale.ENGLISH); nf2.setMinimumFractionDigits(2); nf2.setMaximumFractionDigits(2); NumberFormat nf1 = NumberFormat.getInstance(Locale.ENGLISH); nf1.setMinimumFractionDigits(1); ... |
String | doubleToVisualString(double d) Used to format doubles to two decimal places. DecimalFormat decimalFormat = new DecimalFormat("#.##"); return decimalFormat.format(d); |