Java Double Number Round round(double round, int decimal, int ceilOrFloor)

Here you can find the source of round(double round, int decimal, int ceilOrFloor)

Description

round

License

Apache License

Declaration

public static double round(double round, int decimal, int ceilOrFloor) 

Method Source Code

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

public class Main {
    public static double round(double round, int decimal, int ceilOrFloor) {
        round *= (Math.pow(10, decimal));
        if (ceilOrFloor == 0) {
            round = Math.ceil(round);
        } else {/*from  ww w.  j a v a 2s . c  om*/
            round = Math.floor(round);
        }
        round /= (Math.pow(10, decimal));
        return round;
    }
}

Related

  1. round(double number, int places)
  2. round(double number, int places)
  3. round(double number, int precision)
  4. round(Double number, Integer precision)
  5. round(Double ret, Integer doublePrecision)
  6. round(double Rpred[][])
  7. Round(double Rval, int Rpl)
  8. round(double toRound)
  9. round(double v)