final class UnscaledConversion extends Object
Modifier and Type | Method and Description |
---|---|
static long |
unscaledToLong(DecimalArithmetic arith,
DecimalRounding rounding,
long unscaledValue,
int scale)
Converts the given
unscaledValue with the specified scale
to a long value. |
static long |
unscaledToLong(DecimalArithmetic arith,
long unscaledValue,
int scale)
Converts the given
unscaledValue with the specified scale
to a long value. |
static long |
unscaledToUnscaled(DecimalArithmetic arith,
DecimalRounding rounding,
long unscaledValue,
int scale)
Returns an unscaled value of the scale defined by
arith given an
unscaledValue with its scale . |
static long |
unscaledToUnscaled(DecimalArithmetic arith,
long unscaledValue,
int scale)
Returns an unscaled value of the scale defined by
arith given an
unscaledValue with its scale . |
static long |
unscaledToUnscaled(DecimalRounding rounding,
int targetScale,
DecimalArithmetic arith,
long uDecimal)
Converts an unscaled value
uDecimal having the scale specified by
arith into another unscaled value of the provided
targetScale . |
static long |
unscaledToUnscaled(int targetScale,
DecimalArithmetic arith,
long uDecimal)
Converts an unscaled value
uDecimal having the scale specified by
arith into another unscaled value of the provided
targetScale . |
public static final long unscaledToLong(DecimalArithmetic arith, long unscaledValue, int scale)
unscaledValue
with the specified scale
to a long value. The value is rounded DOWN if necessary. An exception is
thrown if the conversion is not possible.arith
- arithmetic of the target valueunscaledValue
- the unscaled value to convertscale
- the scale of unscaledValue
IllegalArgumentException
- if the conversion cannot be performed due to overflowpublic static final long unscaledToLong(DecimalArithmetic arith, DecimalRounding rounding, long unscaledValue, int scale)
unscaledValue
with the specified scale
to a long value. The value is rounded using the specified
rounding
if necessary. An exception is thrown if the conversion
is not possible.arith
- arithmetic of the target valuerounding
- the rounding to apply if rounding is necessaryunscaledValue
- the unscaled value to convertscale
- the scale of unscaledValue
IllegalArgumentException
- if the conversion cannot be performed due to overflowArithmeticException
- if rounding is necessary and rounding==UNNECESSARY
public static final long unscaledToUnscaled(DecimalArithmetic arith, long unscaledValue, int scale)
arith
given an
unscaledValue
with its scale
. The value is rounded DOWN
if necessary. An exception is thrown if the conversion is not possible.arith
- arithmetic defining the target scaleunscaledValue
- the unscaled value to convertscale
- the scale of unscaledValue
IllegalArgumentException
- if the conversion cannot be performed due to overflowpublic static final long unscaledToUnscaled(DecimalArithmetic arith, DecimalRounding rounding, long unscaledValue, int scale)
arith
given an
unscaledValue
with its scale
. The value is rounded using
the specified rounding
if necessary. An exception is thrown if
the conversion is not possible.arith
- arithmetic defining the target scalerounding
- the rounding to apply if rounding is necessaryunscaledValue
- the unscaled value to convertscale
- the scale of unscaledValue
IllegalArgumentException
- if the conversion cannot be performed due to overflowArithmeticException
- if rounding is necessary and rounding==UNNECESSARY
public static final long unscaledToUnscaled(int targetScale, DecimalArithmetic arith, long uDecimal)
uDecimal
having the scale specified by
arith
into another unscaled value of the provided
targetScale
. The value is rounded DOWN if necessary. An exception
is thrown if the conversion is not possible.targetScale
- the scale of the result valuearith
- arithmetic defining the source scaleuDecimal
- the unscaled value to converttargetScale
IllegalArgumentException
- if the conversion cannot be performed due to overflowpublic static final long unscaledToUnscaled(DecimalRounding rounding, int targetScale, DecimalArithmetic arith, long uDecimal)
uDecimal
having the scale specified by
arith
into another unscaled value of the provided
targetScale
. The value is rounded using the specified
rounding
if necessary. An exception is thrown if the conversion
is not possible.rounding
- the rounding to apply if rounding is necessarytargetScale
- the scale of the result valuearith
- arithmetic defining the source scaleuDecimal
- the unscaled value to converttargetScale
IllegalArgumentException
- if the conversion cannot be performed due to overflow