List of utility methods to do Percentage Format
int | getIntRoundPercent(double f) get Int Round Percent DecimalFormat df = new DecimalFormat("#####"); Double.parseDouble(df.format(f)); return Integer.parseInt(df.format(f)); |
String | getOneDecimalPercentFromDouble(double inValue) Return a percent value with 1 decimal value and the % at the end: 98.7% used everywhere for example to show quality and reference evaluation values in the table String shortString = ""; if (!(new Double(inValue)).isNaN()) { double d = inValue * 100; DecimalFormat oneDec = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.US)); shortString = (oneDec.format(d)); shortString += "%"; } else shortString = "0.0%"; ... |
String | getPercentage(double number) get Percentage NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
return nf.format(number);
|
String | getPercentage(double number, int fractionDigits) get Percentage NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(fractionDigits);
nf.setMinimumFractionDigits(fractionDigits);
return nf.format(number);
|
String | getPercentage(int numerator, int denominator) get Percentage return getPercentage(numerator * 1.00, denominator * 1.00);
|
String | getPercentage(long duration, long lapso) get Percentage nf.setMaximumFractionDigits(1); nf.setMinimumFractionDigits(1); return nf.format((float) duration / (float) lapso * 100) + "%"; |
String | getPercentage(long numerator, long denominator) Find percentage of numerator of denominator if (denominator == 0) { return "NaN"; double percentage = ((double) numerator / (double) denominator) * 100; if ((long) (percentage) == 0) { return "0 %"; DecimalFormat df = new DecimalFormat("0.00"); ... |
String | getPercentageString(double percent) get Percentage String return df.format(percent * 100f) + "%"; |
String | getRoundPercent(double f) get Round Percent DecimalFormat df = new DecimalFormat("#####.00"); return df.format(f); |
String | numberToPercent2Scale(Double number) formats the number {Category} NumberUtil {talendTypes} String {param} double(2.5) number: number to format {example} numberToPercent2Scale(0.12345) result: 12,34% if (number != null) { return numberToString(roundScale2(number * 100d)) + "%"; } else { return ""; |