List of utility methods to do Percentage Format
String | percent(double number) percent return new DecimalFormat("0.00%").format(number); |
String | percent(double p1, double p2) percent String str; if (p1 == 0.0) { return "0.00"; double p3 = p1 / p2; DecimalFormat df1 = new DecimalFormat(".00"); if (p3 * 100 < 1) { df1 = new DecimalFormat("0.00"); ... |
String | percentage(Double v, String postfix) percentage return new DecimalFormat("0.00").format(100. * v) + postfix; |
String | percentage(float f) f should be in the range 0 - 1 if (f < 0f || f > 1f) throw new IllegalArgumentException(); return padToMinWidth(f * 100, 3) + "%"; |
String | percentageAsString(double input) Format the input percentage as a string (using the default locale).
return _format(input, NumberFormat.getPercentInstance());
|
String | percentageFormat(BigDecimal value) percentage Format return new DecimalFormat(PERCENTAGE_FORMAT).format(value); |
String | percentDecimalFormat(final double no) percent Decimal Format final DecimalFormat PERCENT_DECIMAL_FORMAT = ((DecimalFormat) DecimalFormat.getNumberInstance()); PERCENT_DECIMAL_FORMAT.applyPattern("00.00"); return PERCENT_DECIMAL_FORMAT.format(no); |
DecimalFormat | percentFormat() percent Format DecimalFormat format = decimalFormat(); format.setPositiveSuffix("%"); format.setNegativeSuffix("%"); format.setMinimumFractionDigits(2); format.setMaximumFractionDigits(2); format.setRoundingMode(RoundingMode.HALF_UP); return format; |
String | percentFormat(BigDecimal interestRate) percent Format if (interestRate == null) return null; return percentFormat.format(interestRate.doubleValue() * 100) + "%"; |
String | percentFormat(final BigDecimal bd) return a Number formatted or empty string if null. return bd != null ? NUMBER_FORMAT.format(bd.movePointRight(2)) : ""; |