Here you can find the source of ceil(float x)
public static int ceil(float x)
//package com.java2s; //License from project: Apache License public class Main { public static int ceil(float x) { return (int) (Math.ceil(x) + (x > 0 ? 0.5f : -0.5f)); }//from w ww.j av a 2s . c o m public static int ceil(double x) { return (int) (Math.ceil(x) + (x > 0 ? 0.5 : -0.5)); } }