Java Double Number Round roundDouble(double d, int decimals)

Here you can find the source of roundDouble(double d, int decimals)

Description

round Double

License

Open Source License

Declaration

public static double roundDouble(double d, int decimals) 

Method Source Code

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

public class Main {
    public static double roundDouble(double d) {
        return roundDouble(d, 2);
    }/* w w  w .j  a v  a 2 s  .c om*/

    public static double roundDouble(double d, int decimals) {
        long tempD = (long) (d * Math.pow(10, decimals));
        return tempD / (Math.pow(10, decimals));
    }
}

Related

  1. roundDecimals(double d, int decimalPlaces)
  2. roundDecimals(double x, int decimals)
  3. roundDiv(double a, double b)
  4. roundDouble(double d)
  5. roundDouble(double d)
  6. roundDouble(double d, int place)
  7. roundDouble(double d, int places)
  8. roundDouble(double num, int precision)
  9. roundDouble(double number, int precision)