Home » Java BigDecimal floatValue() method with Examples

Java BigDecimal floatValue() method with Examples

by Online Tutorials Library

Java BigDecimal floatValue() method

The floatValue() method of java BigDecimal class is used to Convert this BigDecimal to a float value. when the return value is finite, this conversion can lose information about the precision of the BigDecimal value.

Syntax:

Parameter:

No

Exception:

No

Returns:

It returns float value after conversion from BigDecimal.

Example 1

Test it Now

Output:

Returned float value is : 1532.1276  

Example 2

Test it Now

Output:

Returned float value is : 16322.128  

Example 3

Test it Now

Output:

Returned float value is : 1632662.1  

Example 4

Test it Now

Output:

Returned float value is : -165662.12  

Next TopicJava BigDecimal

You may also like