Java Number Round RoundHalfUp(double d)

Here you can find the source of RoundHalfUp(double d)

Description

Round Half Up

License

Open Source License

Declaration

public static double RoundHalfUp(double d) 

Method Source Code

//package com.java2s;

public class Main {
    public static double RoundHalfUp(double d) {
        return .5 * Math.ceil(d / .5);

        //BigDecimal value = new BigDecimal(d);
        //value.setScale(1, RoundingMode.HALF_UP);
        //return value.doubleValue();
    }/*  w w  w.j  av a2s.  c o m*/
}

Related

  1. roundFloatToPlace(float f, int place)
  2. roundFloatToUnitInverse(final float graphValue, final float graphUnit)
  3. roundFormat(final int numPrec, final double number)
  4. RoundFullUp(double d)
  5. roundHalfAway(double d)
  6. roundIfClose(double val)
  7. Rounding(double d, int i)
  8. rounding(double val)
  9. roundingRightShift(int x, int count)