Java Ceil ceilingHalf(int num)

Here you can find the source of ceilingHalf(int num)

Description

Returns the ceiling of the half of the input value

License

Open Source License

Parameter

Parameter Description
num Input number

Return

Ceiling of the half of the input number

Declaration

public static int ceilingHalf(int num) 

Method Source Code

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

public class Main {
    /**//from  www.j a va 2 s.  c  o m
     * Returns the ceiling of the half of the input value
     * 
     * @param num Input number
     * @return Ceiling of the half of the input number
     */
    public static int ceilingHalf(int num) {
        if ((num & 1) == 1) {
            return (num + 1) / 2;
        } else {
            return num / 2;
        }
    }
}

Related

  1. ceilDivision(int value, int divisor)
  2. ceiling(double d)
  3. ceiling(double d)
  4. ceiling_float_int(float value)
  5. ceilingAbs(double a)
  6. ceilingNextPowerOfTwo(final int x)
  7. ceilingPow2(int n)
  8. ceilingPowerOf2(final int n)
  9. ceilingPowerOf2(int n)