Java Double Number Round round(double d, int p)

Here you can find the source of round(double d, int p)

Description

round

License

Apache License

Declaration

public static double round(double d, int p) 

Method Source Code

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

public class Main {

    public static double round(double d, int p) {
        long tmp = (long) Math.pow(10, p);
        double num = Math.round(d * tmp);
        num /= tmp;//from  w w  w .  j  av a 2s . co m
        return num;
    }
}

Related

  1. round(double d)
  2. round(double d, int decimalPlacesRequired)
  3. round(double d, int decimals)
  4. round(double d, int i)
  5. round(double d, int numDecimal)
  6. round(double d, int precision)
  7. Round(double d, int Rpl)
  8. round(double dValue)
  9. round(double input)