Java BigDecimal limitScale(BigDecimal value, int scale)

Here you can find the source of limitScale(BigDecimal value, int scale)

Description

limit Scale

License

Open Source License

Declaration

static private BigDecimal limitScale(BigDecimal value, int scale) 

Method Source Code


//package com.java2s;
import java.math.*;

public class Main {
    static private BigDecimal limitScale(BigDecimal value, int scale) {

        if (value.scale() > scale) {
            value = value.setScale(scale, RoundingMode.HALF_UP);
        }/*from  ww  w.j  av a2 s .com*/

        return value;
    }
}

Related

  1. intValue(BigDecimal a)
  2. inverse(final BigDecimal amount)
  3. invert(BigDecimal d)
  4. joinBigDecimals(List list)
  5. jsonNumberToBigDecimal(final JsonNumber n, final int defaultValue)
  6. matchScale(BigDecimal[] val)
  7. mean(List numbers, MathContext context)
  8. median(final BigDecimal[] bigDecimalNumbers)
  9. milliToCent(BigDecimal val)