Java Double Number Round roundAtDecimals(double number, int deci)

Here you can find the source of roundAtDecimals(double number, int deci)

Description

round At Decimals

License

Open Source License

Parameter

Parameter Description
Number to round.
Identifies how many digits to round.

Return

Rounded Result.

Declaration

public static double roundAtDecimals(double number, int deci) 

Method Source Code

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

public class Main {
    /**//from   www .  ja v  a  2s  .c  o m
     * @param Number to round.
     * @param Identifies how many digits to round. 
     * @return Rounded Result.  
     */
    public static double roundAtDecimals(double number, int deci) {
        int decimal = deci * 10;
        number = number * decimal;
        Math.round(number);
        return number / decimal;
    }
}

Related

  1. round5(final double value)
  2. round_double(double d)
  3. round_nearestmultipleof5(double value)
  4. roundAndScale(double startValue, int places)
  5. roundAngle(double a, long n)
  6. roundAway(double d)
  7. roundAwayFromZero(double num)
  8. roundBig(double d)
  9. roundDec(float num, int dec)