Java Double Number Round round(double zahl, int stellen)

Here you can find the source of round(double zahl, int stellen)

Description

round

License

Open Source License

Parameter

Parameter Description
zahl a parameter
stellen a parameter

Declaration

public static double round(double zahl, int stellen) 

Method Source Code

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

public class Main {
    /**//from   w w w  . j  av  a  2s.  c  om
     * 
     * @param zahl
     * @param stellen
     * @return
     */
    public static double round(double zahl, int stellen) {
        double d = Math.pow(10, stellen);
        return Math.round(zahl * ((long) d)) / d;
    }
}

Related

  1. round(double x)
  2. round(double x)
  3. round(double x)
  4. round(double x, int numPlaces)
  5. round(double x, int places)
  6. round(double[] arr)
  7. round(double[] array, int decimals)
  8. round(double[][] data)
  9. round(final double num)