Java Decimal Round round(double dValue)

Here you can find the source of round(double dValue)

Description

round

License

Open Source License

Declaration

public static double round(double dValue) 

Method Source Code

//package com.java2s;
//    it under the terms of the GNU General Public License as published by

import java.text.NumberFormat;

public class Main {
    public static double round(double dValue) {
        NumberFormat currencyFormat = NumberFormat.getCurrencyInstance();
        double fractionMultiplier = Math.pow(10.0,
                currencyFormat.getMaximumFractionDigits());
        return Math.rint(dValue * fractionMultiplier) / fractionMultiplier;
    }// ww  w  . j  av a2 s.  c  om
}

Related

  1. getRoundedValue(double doubleValue)
  2. getRoundedValue(double value)
  3. round(double d, int n)
  4. round(double d, int p)
  5. round(double number)
  6. round(double unrounded, int precision)
  7. round(final double value)
  8. roundAlloc(Double alloc)