Java Utililty Methods BigDecimal Normalize

List of utility methods to do BigDecimal Normalize

  1. HOME
  2. Java
  3. B
  4. BigDecimal Normalize

Description

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

Method

BigDecimal normalize(BigDecimal bigDecimal)
Nastavi standardni zaokrouhlovani.
return bigDecimal.setScale(STANDARD_SCALE, STANDARD_ROUNDING_MODE);
BigDecimal normalize(final BigDecimal dec)
normalize
return new BigDecimal(dec.toPlainString());
BigDecimal normalizeDecimalValue(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;
int normalizePrecision(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;
BigDecimal normalizeScale(BigDecimal bigDecimal)
Normalizes the scale of bigDecimal to 2 decimal places and RoundingMode#HALF_UP .
return bigDecimal == null ? null : bigDecimal.setScale(2, HALF_UP);

AltStyle によって変換されたページ (->オリジナル) /