YouTip LogoYouTip

Number Floor

# Java floor() Method [![Image 3: Java Number Class](#)Java Number Class](#) * * * The floor() method rounds a number down, returning the largest integer that is less than or equal to the given argument. ### Syntax The method has the following syntax formats: double floor(double d)double floor(float f) ### Parameters * A primitive data type of double or float. ### Return Value Returns a double value that is less than or equal to the given argument. ### Example ## Example public class Test{public static void main(String args[]){double d = 100.675; float f = -90; System.out.println(Math.floor(d)); System.out.println(Math.floor(f)); System.out.println(Math.ceil(d)); System.out.println(Math.ceil(f)); }} Compile and run the above program, the output result is: 100.0-90.0101.0-90.0 * * Java Number Class](#)
← Number RoundNumber Abs β†’