Java Utililty Methods BigDecimal Normalize

List of utility methods to do BigDecimal Normalize

Description

The list of methods to do BigDecimal Normalize are organized into topic(s).

Method

BigDecimalnormalize(BigDecimal bigDecimal)
Nastavi standardni zaokrouhlovani.
return bigDecimal.setScale(STANDARD_SCALE, STANDARD_ROUNDING_MODE);
BigDecimalnormalize(final BigDecimal dec)
normalize
return new BigDecimal(dec.toPlainString());
BigDecimalnormalizeDecimalValue(BigDecimal bigDecimal, int allowedPrecision)
This method will check the digits before dot with the max precision allowed
if (bigDecimal.precision() > allowedPrecision) {
    return null;
return bigDecimal;
intnormalizePrecision(String precision, BigDecimal... decimals)
Returns the specified precision unless it is null, in which case the maximum precision from the list of decimals is returned.
int result;
if (precision != null) {
    result = Integer.parseInt(precision);
} else {
    result = getMaxPrecision(decimals);
return result;
BigDecimalnormalizeScale(BigDecimal bigDecimal)
Normalizes the scale of bigDecimal to 2 decimal places and RoundingMode#HALF_UP .
return bigDecimal == null ? null : bigDecimal.setScale(2, HALF_UP);