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

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

Description

round

License

Apache License

Declaration

public static double round(double value, int places) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static double round(double value, int places) {
        if (places < 0)
            throw new IllegalArgumentException();
        long factor = (long) Math.pow(10, places);
        return (double) Math.round(value * factor) / factor;
    }/*from   ww w . j a  v  a2s .  c  om*/
}

Related

  1. round(double value, int decimals)
  2. round(double value, int exponent)
  3. round(double value, int nbDigits)
  4. round(double value, int numberOfDecimalPlaces)
  5. round(double value, int numDecimals)
  6. round(double value, int places)
  7. round(double value, int power)
  8. round(double value, int precision)
  9. round(double value, int precision)