Here you can find the source of ceil(final double num)
Parameter | Description |
---|---|
num | number to round up. |
public static int ceil(final double num)
//package com.java2s; //License from project: Open Source License public class Main { /**//w w w .j av a2 s . c o m * Round up given number. * * @param num number to round up. * * @return rounded number. * * @see Math#round(double) */ public static int ceil(final double num) { final int ceil = (int) num; return (ceil == num) ? ceil : ((num > 0) ? (ceil + 1) : ceil); } /** * Round up given number. * * @param num number to round up. * * @return rounded number. * * @see Math#round(double) */ public static int ceil(final float num) { final int ceil = (int) num; return (ceil == num) ? ceil : ((num > 0) ? (ceil + 1) : ceil); } }