# Series: class Math

class Math static methods explained with programs and screenshots in simple terms for beginner

## class Math Java

Introduction The java.lang.Math class includes many methods with which many simple arithmetic operations can be done like finding the square root, rounding, trigonometric and logarithm functions. As these methods are defined as static, they can be used directly by the programmer without the trouble of creating an object. Following is the class signature as defined …

## Find Square root of Number sqrt() Java

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is sqrt() method which returns the square root of a number passed as parameter. One advantage of Math class methods is that they are declared as static so that they can be called without the need of object creation. Following …

## Find Minimum of Two Numbers min() Java

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is min() method which returns the minimum of two numbers passed as parameter. One advantage of Math class methods is that they are declared as static so that they can be called without the need of object creation. Following is …

## Find Maximum of Two Numbers max()

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is max() method which returns the maximum of two numbers passed as parameters. One advantage of Math class methods is that they are declared as static so that they can be called without the need of object creation. Following is …

## Java Find Absolute value abs()

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is abs() method which returns always a positive value (knwon as absolute value) of any postive or negative number (int, long, float or double) passed as parameter. Sometimes, it may be required in computing always a positive value eventhough user …

## Java Round up to Upper value Math ceil()

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is ceil() method which returns always a nearest higher double value of a number. One advantage of Math class methods is that they are declared as static so that they can be called without the need of object creation. Following …

## Java Round up to Lower value floor()

Java Round up to Lower value floor() java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is floor() method which returns always a nearest lower double value of a number. One advantage of Math class methods is that they are declared as static so that they can be called …

## Power of Number Java Math pow() Function

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is pow() method which returns power of a number raised to another number. One advantage of Math class methods is that they are declared as static so that they can be called without the need of object creation. Following is …

## Java Rounding value round() Function

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is round() method which returns always a nearest rounded integer/long value of a number. With round() method, a float or double value can be rounded off. Read down. One advantage of Math class methods is that they are declared as …

## Java Rounding to double Math rint()

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is rint() method which returns the nearest rounded double value of a number passed as parameter. One advantage of Math class methods is that they are declared as static so that they can be called without the need of object …

## Difference Math.rint() Math.round()

Difference Math.rint() Math.round() First find the preliminary difference of rint() and round() methods 1. System.out.println(Math.rint(2.50)); // prints 2.0 2. System.out.println(Math.round(2.50)); // prints 3 Let us study more: 1. With rint() a) 2.50 lies between 2.00 and 3.00. rint() returns the closest even double value. The rint(2.50) returns 2.0 b) 1.50 lies between 1.00 and 2.00. …

## Java Random Number Generation random()

java.lang.Math class comes with many methods to do simple basic numeric operations. One such one is random() method which returns a pseudorandom number from 0.0 to less than 1.0. That is, the range of random() method generates is greater than or equal to 0.0 to less than 1.0 (exclusive of 1.0). The random numbers generated …