Check out example codes for "math class in java". It will help you in understanding the concepts better.

Code Example 1

double floor = Math.floor(7.343);  // floor = 7.0
//rounds to the value down to the nearest integer value (returned as double)

Code Example 2

double random = Math.random();
// chooses random number between 0 and 1 ( * 100 to make it in 100)

Code Example 3

double ceil = Math.ceil(7.343);  // ceil = 8.0
//rounds up to the nearest integer value

Code Example 4

double roundedDown = Math.round(23.445);
double roundedUp   = Math.round(23.545);
// rounds up and down from float or double

Code Example 5

int max = Math.max(10, 20);
//returns largest of two value in parameter

Code Example 6

int min = Math.min(10, 20);
//retirms tje smallest of two values in parameter

Learn ReactJs, React Native from akashmittal.com