Java Double Number Round round(double value, int decimalPlace)

Here you can find the source of round(double value, int decimalPlace)

Description

round

License

Open Source License

Declaration

public static double round(double value, int decimalPlace) 

Method Source Code

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

public class Main {
    public static double round(double value, int decimalPlace) {
        double power_of_ten = 1;
        while (decimalPlace-- > 0)
            power_of_ten *= 10.0;//from  w  w  w  .j  a  v a  2s  . c  o  m
        return Math.round(value * power_of_ten) / power_of_ten;
    }
}

Related

  1. round(double value, double factor)
  2. round(double value, double increment)
  3. round(double value, double precision)
  4. round(double value, int decimal)
  5. round(double value, int decimal)
  6. round(double value, int decimalPlaces)
  7. round(double value, int decimalPlaces)
  8. round(double value, int decimals)
  9. round(double value, int decimals)