List of utility methods to do Fraction Format
String | formatDataValue(double value) format Data Value NumberFormat dataValueFormat = new DecimalFormat("0"); return dataValueFormat.format(value); |
String | formatDecimal(double dtSource, String nbit) format Decimal java.text.DecimalFormat formatter = null; try { formatter = new java.text.DecimalFormat("#,###." + nbit); } catch (Exception e) { System.out.println(e.getMessage()); return formatter.format(dtSource); |
String | formatDecimal(double number) format Decimal NumberFormat format = NumberFormat.getInstance();
format.setMaximumIntegerDigits(Integer.MAX_VALUE);
format.setMaximumFractionDigits(2);
format.setMinimumFractionDigits(2);
return format.format(number);
|
String | formatDecimal(double numToFormat) format Decimal return decimalFormatter.format(numToFormat);
|
String | formatDecimal(double value) format Decimal String result1;
result1 = nf.format(value);
return result1;
|
String | formatDecimal(double value, int maxFractionDigits1, int maxFractionDigits2) format Decimal formatter.setMaximumFractionDigits(maxFractionDigits1); formatter2.setMaximumFractionDigits(maxFractionDigits2); if (value > 0 && (Math.abs(value) < 0.001 || Math.abs(value) >= 100000.0)) { return formatter.format(value); } else { return formatter2.format(value); |
String | formatDecimal(double value, int precision) Format decimal string. DecimalFormat df = getDecimalFormat(precision, "#"); return df.format(value); |
String | formatDecimal(double value, String mask) Formata um decimal, de acordo com a mascara. DecimalFormatSymbols dfs = new DecimalFormatSymbols(); dfs.setDecimalSeparator(','); dfs.setGroupingSeparator('.'); DecimalFormat df = new DecimalFormat(mask, dfs); return df.format(value); |
String | formatDecimal(String format, double value) format Decimal DecimalFormat df = new DecimalFormat(format); return df.format(value); |
double | formatDecimals(double d, int mantissa) Change the precision of a double value, according to the new mantissa. String m = ""; for (int i = 0; i < mantissa; i++) { m += "#"; DecimalFormat decimalForm = new DecimalFormat("#." + m); return Double.valueOf(decimalForm.format(d)); |