BigDecimal.floatValue() has the following syntax.
public float floatValue()
In the following code shows how to use BigDecimal.floatValue() method.
// w w w . j a v a 2 s . co m import java.math.BigDecimal; public class Main { public static void main(String[] args) { BigDecimal bg = new BigDecimal("1234.123456"); Float f = bg.floatValue(); System.out.println(f); } }
The code above generates the following result.