The java.math.BigDecimal.scaleByPowerOfTen(int n) is an inbuilt method on java that returns a BigDecimal whose numerical value is equal to (this * 10n). The scale of the result is (this.scale() – n).
public BigDecimal scaleByPowerOfTen(int n)
The method accepts a single parameter n of integer type which refers to the value by which BigDecimal object is multiplied to power of ten.
Return value:This method returns the BigDecimal object of value this * 10n.
Below program illustrates the above mentioned method:
754.000 raised to power is 7.54000E+6 75400 raised to power is 7.5400
200 raised to power is 2.00E+6 7540000000 raised to power is 754000.0000
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.