Java Percentage Format roundedPercentageGreaterThan(double left, double right)

Here you can find the source of roundedPercentageGreaterThan(double left, double right)

Description

rounded Percentage Greater Than

License

Open Source License

Declaration

public static boolean roundedPercentageGreaterThan(double left,
              double right) 

Method Source Code

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

import java.math.RoundingMode;
import java.text.DecimalFormat;

public class Main {
    public static boolean roundedPercentageGreaterThan(double left,
            double right) {
        return (left > right)
                && !formatPercentage(left).equals(formatPercentage(right));
    }//from   w  ww.ja  va 2  s.c o  m

    public static String formatPercentage(double d) {
        DecimalFormat df = new DecimalFormat("0.0");
        df.setRoundingMode(RoundingMode.HALF_UP);
        return df.format(d);
    }
}

Related

  1. percentFormat(final BigDecimal bd)
  2. percentFormat(final double value)
  3. percentFormat(float value)
  4. percentFormat(Object object)
  5. percentTotal(double value, double total)
  6. toPercent(Double doubleValue)
  7. toPercent(double percent)
  8. toPercent(double value)
  9. toPercent(float f)