Home » Tag Archives: math

# Tag Archives: math

## Math.pow Java Example

In this article, we examine the Math.pow Java method and we provide some examples of its use. 1. Introduction The java.lang package provides classes and interfaces that are central to the Java programming language. The Math class from the java.lang package contains static methods for performing many common math operations. These include exponential, logarithm, square root, and trigonometric functions. One ...

## Generate random Integer within given range

In this example we shall show you how to generate a random Integer within a given range, using random() method of Math. The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. To generate a random Integer within a given range one should perform the following steps: Use random() method of ...

## Find floor value of a number

With this example we are going to demonstrate how to find the floor value of a number, using the floor(double a) API method of Math. Math API provides methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. In short, to find the floor value of a number you should: Use floor(double a) method ...

## Find natural logarithm value of a number

This is an example of how to find the natural logarithm value of a number, using the log(double a) method of Math. The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. Finding the natural logarithm value of a number implies that you should: Use log(double a) API method ...

## Find ceiling value of a number

In this example we shall show you how to find the ceiling value of a number, using the Math Class. The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. To find the ceiling value of a number one should perform the following steps: Use ceil(double a) method of ...

## Round float and double numbers

With this example we are going to demonstrate how to round float and double numbers using round() method of Math. The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. In short, to round float and double numbers you should: Use round(float a) method to get the closest int to ...

## Java BigDecimal Example

This is an example of how to use a BigDecimal in Java. A BigDecimal consists of an arbitrary precision integer unscaled value and a 32-bit integer scale. If zero or positive, the scale is the number of digits to the right of the decimal point. If negative, the unscaled value of the number is multiplied by ten to the power ...

## Using Math Constants

In this example we shall show you how to get constant numbers using the Math Class. Apart from the methods for performing basic numeric operations such as square root, and trigonometric functions, the Math Class also has methods for getting the e, that is the base of the natural logarithms and the PI, that is the ratio of the circumference of ...