List of utility methods to do Number Percentage Format
String | getPercent(Double num) get Percent DecimalFormat df = new DecimalFormat("############0.00"); String rtNum = df.format(num * 100); return rtNum + "%"; |
String | getPercent(double percent) get Percent return new DecimalFormat("#.##").format(percent); |
String | getPercent(Double value) get Percent if (value != null && value > 0) { DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(1); df.setMinimumFractionDigits(1); if (1 == value) { return "100%"; } else { return df.format(value * 100) + "%"; ... |
String | getPercent(final long downloadCurrent, final long downloadMax) get Percent return (new DecimalFormat("0.00")).format(100.0 * downloadCurrent / downloadMax) + "%"; |
String | getPercent(long l1, long l2) get Percent final double ratio = l1 / (double) l2; if (ratio < 0.001d) { return "<0.1%"; final DecimalFormat percentFormat = new DecimalFormat("#.#%"); return percentFormat.format(ratio); |
String | getPercent(long val1, long val2) get Percent return NF.format((double) val1 / val2); |
NumberFormat | getPercentFormatter() get Percent Formatter NumberFormat format = DecimalFormat.getPercentInstance();
format.setMinimumFractionDigits(1);
format.setMaximumFractionDigits(1);
return format;
|
String | getPercentileWithSuffix(double percentile) get Percentile With Suffix String percentileText = new DecimalFormat("0.#########").format(percentile); return percentileText + getPercentileSuffix(percentileText); |
String | getPercentileWithSuffix(double percentile) get Percentile With Suffix String percentileText = new DecimalFormat("0.#########").format(percentile); return percentileText + getPercentileSuffix(percentileText); |
String | getPercentMemUse() get Percent Mem Use return format.format(((float) runtime.totalMemory() / (float) runtime.maxMemory()) * 100); |