List of utility methods to do Decimal Format
double | trim(int degree, double d) trim String format = "#.#"; for (int i = 1; i < degree; i++) { format = format + "#"; DecimalFormat twoDForm = new DecimalFormat(format); return Double.valueOf(twoDForm.format(d)).doubleValue(); |
double | trim(int level, double value) trim StringBuilder sb = new StringBuilder("#.#"); for (int i = 0; i < level; i++) sb.append("#"); return Double.valueOf(new DecimalFormat(sb.toString()).format(value)); |
Double | trim2Decimals(Double value) trim Decimals return Double.parseDouble(createDecimalFormatter("#.##").format(value)); |
String | truncate(double d) Truncates a double to two places, and makes it a string. return decFormat.format(d);
|