Java floor floorHalf(int num)

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

Description

Returns the floor of the half of the input value

License

Open Source License

Parameter

Parameter Description
num Input number

Return

Floor of the half of the input number

Declaration

public static int floorHalf(int num) 

Method Source Code

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

public class Main {
    /**/*from  ww w  . ja va  2  s  .co  m*/
     * Returns the floor of the half of the input value
     * 
     * @param num Input number
     * @return Floor of the half of the input number
     */
    public static int floorHalf(int num) {
        if ((num & 1) == 1) {
            return (num - 1) / 2;
        } else {
            return num / 2;
        }
    }
}

Related

  1. floorDiv(long x, long y)
  2. floorDivide(int value, int divisor)
  3. floorDivide(long n, long d)
  4. floorDivide(long numerator, long denominator)
  5. floorDivision(int i, int divisor)
  6. floorInt(Double d, double intv)
  7. floorInt(float x)
  8. floorLogBaseTwo(final int i)
  9. floorLong(final double x)