Java examples for Language Basics:Math
To find a floor value, use static double floor(double d) method of Math class.
It returns a largest integer which is not greater than the argument value.
public class Main { public static void main(String[] args) { System.out.println(Math.floor(110)); //from w w w.j a va 2 s. c om System.out.println(Math.floor(310.1)); System.out.println(Math.floor(115.5)); System.out.println(Math.floor(-41)); System.out.println(Math.floor(-421.4)); System.out.println(Math.floor(0)); } }