List of utility methods to do Double Number Format
String | convertDouble(double damage) Convert endless decimal health to a 2 lengthed one. NumberFormat nf = new DecimalFormat("##.##"); return nf.format(damage); |
String | doubleFormat(Double d) Formats a double to two decimal places return doubleFormat(d, 0);
|
String | doubleFormat(double d) double Format DecimalFormat df = new DecimalFormat("#########.###"); return df.format(d); |
String | doubleFormat(double number) A number formatted in a String NumberFormat nf_out = NumberFormat.getNumberInstance(Locale.UK);
nf_out.setMaximumFractionDigits(2);
return nf_out.format(number);
|
String | doubleFormat(double val, boolean hiRes) Format a double if (Double.isNaN(val)) { return ("NaN"); double abs = Math.abs(val); if (abs == 0.0) { return ("0.0"); } else if (abs < (hiRes ? 1.0E-2 : 1.0E-1)) { return (tinyNums_.format(val)); ... |
double | format(double b) format return Math.round(b * 100) / 100.0;
|
String | format(double d, int decimals) Returns d as a string truncated to the specified number of decimal places double factor = Math.pow(10, decimals); double digits = Math.round(factor * d); return ((int) Math.floor(digits / factor)) + "." + ((int) (digits % factor)); |
String | format(Double decimal) Attempts to format a Double to a String to the #DEFAULT_PRECISION . return format(decimal, DEFAULT_PRECISION);
|
double | format(double num, int n) Formats a double with an specified number of decimals. long m = (long) Math.pow(10, n); num *= m; long aux = ((long) num); num = (double) ((double) aux / (double) m); return num; |
String | format(double number) format if (number == (int) number) return String.valueOf((int) number); else return String.valueOf(number); |