BigDecimal.valueOf

BigDecimal.valueOf

Class Overview | Class Members | This Package | All Packages

Syntax 1
public static BigDecimal valueOf( long val, int scale ) throws NumberFormatException
Description
Returns a BigDecimal with a value of (val/10**scale). This factory is provided in preference to a (long) constructor because it allows for reuse of frequently used BigDecimals (like 0 and 1), obviating the need for exported constants. A negative scale will result in a NumberFormatException.



Syntax 2
public static BigDecimal valueOf( long val )
Description
Returns a BigDecimal with the given value and a scale of zero. This factory is provided in preference to a (long) constructor because it allows for reuse of frequently used BigDecimals (like 0 and 1), obviating the need for exported constants.