List of utility methods to do Number Percentage Format
String | getPercentNumber(double num, int scale) get Percent Number NumberFormat format = NumberFormat.getPercentInstance();
format.setMinimumFractionDigits(scale);
return format.format(num);
|
String | getPercentString(double numerator, double denominator) get Percent String if (denominator == 0) { return "0.00%"; return FORMAT_PERCENT.format((numerator / denominator) * 100) + "%"; |
String | getPercentValue(double value) Takes a double and turns it into a percent string. value = Math.floor(value * 100) / 100;
return NumberFormat.getPercentInstance().format(value);
|
String | getPercentWidth(int iColspan, int iMaxTd) get Percent Width double dMin = iColspan * 1.0; double dMax = iMaxTd * 1.0; double dResult = dMin / dMax; NumberFormat objNf = NumberFormat.getPercentInstance(); objNf.setMinimumFractionDigits(0); return objNf.format(dResult); |