Java Number Percentage Format getPercentString(double numerator, double denominator)

Here you can find the source of getPercentString(double numerator, double denominator)

Description

get Percent String

License

Apache License

Declaration

public static String getPercentString(double numerator, double denominator) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.NumberFormat;

public class Main {
    private static final NumberFormat FORMAT_PERCENT = NumberFormat.getNumberInstance();

    public static String getPercentString(double numerator, double denominator) {
        if (denominator == 0) {
            return "0.00%";
        }/*from  w  w  w  . j  a  v a2s .  com*/
        return FORMAT_PERCENT.format((numerator / denominator) * 100) + "%";
    }
}

Related

  1. getPercentFormatter()
  2. getPercentileWithSuffix(double percentile)
  3. getPercentileWithSuffix(double percentile)
  4. getPercentMemUse()
  5. getPercentNumber(double num, int scale)
  6. getPercentValue(double value)
  7. getPercentWidth(int iColspan, int iMaxTd)