Here you can find the source of floorHalf(int num)
Parameter | Description |
---|---|
num | Input number |
public static int floorHalf(int num)
//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; } } }