List of utility methods to do Decimal Format
Double | getDoubleByNumeric(String valorTexto) get Double By Numeric NumberFormat df = DecimalFormat.getInstance(localBrasil);
return df.parse(valorTexto).doubleValue();
|
String | getDoubleDecimalNumber(double d) get Double Decimal Number return decimalFormat.format(d);
|
double | getDoubledigit(double f) get Doubledigit DecimalFormat df = new DecimalFormat("#####.00"); return Double.parseDouble(df.format(f)); |
String | getDoubleForDisplay(Double d) get Double For Display if (d == null) { return ""; } else if (d == 0) { return ""; } else { return df.format(d); |
double | getDoubleFromTaxSet(String taxSetValue) get double value from arbitrary String represent a double (0,00) or (0.00) NumberFormat nf = NumberFormat.getNumberInstance(Locale.GERMAN); DecimalFormat decimalFormat = (DecimalFormat) nf; Exception parseException; try { return decimalFormat.parse(taxSetValue).doubleValue(); } catch (ParseException ignored) { nf = NumberFormat.getNumberInstance(Locale.US); ... |
double | getDoubleWithTwoDecimalDigits(double value) get Double With Two Decimal Digits DecimalFormat df = new DecimalFormat("0.00", new DecimalFormatSymbols(Locale.US)); return Double.valueOf(df.format(value)); |
String | getDurationString(double duration) get Duration String return df.format(duration) + "s"; |
String | getEngineeringNotation(final double d) get Engineering Notation final String engineeringNotation = engineeringFormat.format(d); if (engineeringNotation.endsWith(E0)) { return engineeringNotation.substring(0, engineeringNotation.length() - E0.length()); return engineeringNotation; |
Integer | getInteger(Double d) get Integer if (d == null) { return null; } else { return Integer.valueOf(integerFormatter.format(d)); |
int | getIntNum(Double value) get Int Num DecimalFormat df = new DecimalFormat("#"); String str = df.format(value).replaceAll("-", ""); return str.length(); |