double floor(double d) returns the largest integer that is not greater than d (returns as a double) : Math class « Utility Classes « SCJP






public class MainClass{
  public static void main(String[] argv){
    System.out.println(Math.floor(1.2));
    System.out.println(Math.floor(-1.2));
  }
}
1.0
-2.0








8.6.Math class
8.6.1.Java's Math class contains methods and constants that support mathematical computation.
8.6.2.The two constants of the Math class are Math.PI and Math.E.
8.6.3.int abs(int i): returns Absolute value of int i
8.6.4.long abs(long l) returns Absolute value of long l
8.6.5.float abs(float f) returns Absolute value of float f
8.6.6.double abs(double d) returns Absolute value of double d
8.6.7.double ceil(double d) returns the smallest integer that is not less than d (returns as a double)
8.6.8.double exp(double a) retruns e raised to the a power
8.6.9.double floor(double d) returns the largest integer that is not greater than d (returns as a double)
8.6.10.double log(double a) returns Logarithm of a
8.6.11.int max(int i1, int i2) returns Greater of i1 and i2
8.6.12.long max(long l1, long l2) returns Greater of l1 and l2
8.6.13.float max(float f1, float f2) returns Greater of f1 and f2
8.6.14.double max(double d1, double d2) returns Greater of d1 and d2
8.6.15.int min(int i1, int i2) returns Smaller of i1 and i2
8.6.16.long min(long l1, long l2) returns Smaller of l1 and l2
8.6.17.float min(float f1, float f2) returns Smaller of f1 and f2
8.6.18.double min(double d1, double d2) returns Smaller of d1 and d2
8.6.19.double pow(double a, double b) returns a raised to the b power
8.6.20.double random() returns Random number >= 0.0and < 1.0
8.6.21.int round(float f) returns Closest int to f
8.6.22.long round(double d) returns Closest long to d
8.6.23.double sin(double d) returns Sine of d
8.6.24.double cos(double d) returns Cosine of d
8.6.25.double tan(double d) returns Tangent of d
8.6.26.double sqrt(double d) return Square root of d