views:

210

answers:

3

I found BigDecimal have setScale method, but doesn't have getScale method. How to getScale on BigDecimal?

+2  A: 

You have the scale() (not getScale in this case) method in BigDecimal which returns the scale set by setScale(..). See: http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#scale()

Gadi
A: 

use BigDecimal.scale()

Babar
+2  A: 

BigDecimal.scale():

public int scale()

Returns the scale of this BigDecimal. 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 of the negation of the scale. For example, a scale of -3 means the unscaled value is multiplied by 1000.

Returns: the scale of this BigDecimal.

gimel