English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Java Basic Tutorial

Java Flow Control

Java Array

Java Object-Oriented (I)

Java Object-Oriented (II)

Java Object-Oriented (III)

Java Exception Handling

Java List (List)

Java Queue (Queue)

Java Map Collection

Java Set Collection

Java Input and Output (I/O)

Java Reader/Writer

Java other topics

Java Math Mathematical Methods

Java has many Math methods that allow us to perform mathematical calculations. In this reference page, you will find all the available math mathematical methods in Java, examples of math mathematical methods. For example, if you need to get the square root of a number, use the sqrt() method.

MethodDescription
abs()Return the absolute value of the number
acos()Return the inverse cosine value of the specified value
addExact()Add the specified number and return
asin()Return the inverse sine value of the specified parameter
atan()Return the inverse tangent function value
cos()Return the cosine value of the specified angle
sin()Return the sine value of the specified angle in radians
tan()Return the tangent value of the specified angle
sinh()Return the hyperbolic sine value of the specified value
cosh()Return the hyperbolic cosine value of the specified value
tanh()Return the hyperbolic tangent of the specified value
sqrt()Return the square root of the specified number
cbrt()Return the cube root of the specified number
pow()Return the power
subtractExact()Subtract the specified number and return
multiplyExact()Multiply the specified number and return
incrementExact()Add the specified number to1And return it
decrementExact()Subtract the specified number from1And return
negateExact()Negate the specified variable and return
toIntExact()Return an int value from the specified long parameter
min()Return the smaller value in the parameters
max()Return the maximum value in the parameters
ceil()Round up the specified value
floor()Round down the specified value and return
round()round()
Round the specified parameter and returntoRadians()
Convert angles from degrees to radianstoDegrees()
Convert angles from radians to degrees2}atan
Return the angle θ that converts the coordinates (x, y) to (r, θ)copySign()
Copy the sign of the second parameter to the first parameterexp()
Return e raised to the given value's power1}expm1Return e raised to the given value minus
PowergetExponent()
Return the unbiased exponent of the specified numberhypot()
Calculate the hypotenuse of a right triangleIEEEremainder() 754According to IEEE
Standard return remainderlog()
log10}Return the natural logarithm of the specified value10Logarithm to base
log1p()Return (specified value+ 1Natural logarithm of )
nextAfter()Return the number adjacent to the specified number
nextUp()Return the number greater than and adjacent to the value
nextDown()Return the number less than and adjacent to the value
rint()Return the nearest mathematical integer to the value
random()Return 0.0 to1Random Value Between .0