Java Double Number Round round(double what, int howmuch)

Here you can find the source of round(double what, int howmuch)

Description

round

License

Open Source License

Parameter

Parameter Description
what a parameter
howmuch a parameter

Return

double

Declaration

public static double round(double what, int howmuch) 

Method Source Code

//package com.java2s;

public class Main {
    /**// w  ww .  j  a  va2 s .com
     * round
     * @param what
     * @param howmuch
     * @return double
     */
    public static double round(double what, int howmuch) {
        return (double) ((int) (what * Math.pow(10, howmuch) + .5)) / Math.pow(10, howmuch);
    }
}

Related

  1. round(double value, int precision)
  2. round(double value, int roundingFactor)
  3. round(double value, int scalar, int standard)
  4. round(double valueToRound, int numberOfDecimalPlaces)
  5. round(double valueToTruncate, int requiredDecimalPlaces)
  6. round(double x)
  7. round(double x)
  8. round(double x)
  9. round(double x)