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