Java Percentage Format getIntRoundPercent(double f)

Here you can find the source of getIntRoundPercent(double f)

Description

get Int Round Percent

License

Open Source License

Declaration


public static int getIntRoundPercent(double f) 

Method Source Code

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

import java.text.DecimalFormat;

public class Main {

    public static int getIntRoundPercent(double f) {

        DecimalFormat df = new DecimalFormat("#####");
        Double.parseDouble(df.format(f));

        return Integer.parseInt(df.format(f));
    }//ww  w. j a va  2s  . co m

    public static Double parseDouble(String str) {
        try {
            DecimalFormat df = new DecimalFormat("#,##0.0#");
            return Double.valueOf(String.valueOf(df.parseObject(str)));
        } catch (Exception e) {
            return new Double(0.0);
        }
    }
}

Related

  1. formatPercentage(Double percentage)
  2. formatPercentage(double percentage)
  3. formatPercentage(double percentage)
  4. formatPercentage(int enumerator, int denominator)
  5. formatTimePercent(long part, long tot)
  6. getOneDecimalPercentFromDouble(double inValue)
  7. getPercentage(double number)
  8. getPercentage(double number, int fractionDigits)
  9. getPercentage(int numerator, int denominator)