English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Java Math Mathematical Methods
The Java Math floor() method rounds down the specified double value and returns it.
The integer part should be equal to a mathematical integer. That is, the value3.8Should be rounded to3.0, equal to an integer3.
The syntax of the floor() method is:
Math.floor(double value)
Note: floor() is a static method. Therefore, we can access this method using the class name Math.
value - The number to be rounded up
Returns the rounded value equal to a mathematical integer
Note: The returned value should be the largest value that is greater than or equal to the specified parameter.
class Main { public static void main(String[] args) { //Math.Floor() Method. //is greater than the decimal point5The value double a = 1.878; System.out.println(Math.floor(a)); // 1.0 //The value after the decimal point is equal to5 double b = 1.5; System.out.println(Math.floor(b)); // 1.0 //is less than the decimal point5The value double c = 1.34; System.out.println(Math.floor(c)); // 1.0 } }