Math Class methods helps to perform the numeric operations like square, square root, cube, cube root, exponential and trigonometric operations.

Methods of lang.math class :

Method Name

Description

1. abs()

java.lang.Math.abs() method returns the absolute value of any type of argument passed.

2. acos()

java.lang.Math.acos() method returns the arc cosine value of the passed argument.

arc      cosine      is      inverse      cosine      of      the      argument      passed. acos(arg) = cos-1 of arg

3. asin()

java.lang.Math.asin() method returns the arc sine value of the method argument passed.

arc          sine          is          inverse         sine          of          the          argument                passed. asin(arg) = sine-1 of arg

4. sqrt()

java.lang.Math.sqrt() returns the square root of a value of type double passed to it as argument.

5. cbrt()

java.lang.Math.cbrt() method returns the cube root of the passed argument.

6. floor()

java.lang.Math.floor() method returns the floor value of an argument i.e. the closest integer value which is either less or equal to the the passed argument.

eg : 101.23 has floor value = 101.

7. log()

java.lang.Math.log() method returns the logarithmic value of the passed argument.

8. ceil()

java.lang.Math.ceil(double a) method returns the smallest possible value which is either greater or equal to the argument passed. The returned value is a mathematical integer.

9. atan()

java.lang.Math.atan() method returns returns the arc tangent of the method argument value. arc tan is inverse tan of the argument passed. atan(arg) = tan inverse of arg

Example of lang.math with its methods

           

OUTPUT: