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

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

Description

round

License

Apache License

Declaration

public static double round(double value, int numberOfDecimalPlaces) 

Method Source Code

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

public class Main {
    public static double round(double value, int numberOfDecimalPlaces) {
        double multipicationFactor = Math.pow(10, numberOfDecimalPlaces);
        return Math.round(value * multipicationFactor) / multipicationFactor;
    }/*w ww  . j a va 2 s  .c o  m*/
}

Related

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