Java Percentage Format formatPercentage(double percentage)

Here you can find the source of formatPercentage(double percentage)

Description

format Percentage

License

Open Source License

Declaration

public static String formatPercentage(double percentage) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.DecimalFormat;

import java.text.NumberFormat;

public class Main {
    private static NumberFormat percentageFormatter;

    public static String formatPercentage(double percentage) {
        if (percentageFormatter == null) {
            percentageFormatter = new DecimalFormat("#0.0%");
        }//  ww  w  .  ja v  a2s  . co m

        return percentageFormatter.format(percentage);
    }
}

Related

  1. formatPercent(double v)
  2. formatPercent(final long value, final long total)
  3. formatPercent(float p_num)
  4. formatPercent1dp(double frac)
  5. formatPercentage(double perc)
  6. formatPercentage(double percentage)
  7. formatPercentage(Double percentage)
  8. formatPercentage(int enumerator, int denominator)
  9. formatTimePercent(long part, long tot)