BigDecimal: divide(BigDecimal divisor, int roundingMode) : BigDecimal « java.math « Java by API






BigDecimal: divide(BigDecimal divisor, int roundingMode)

  

import java.math.BigDecimal;

public class Main {
  public static void main(String[] argv) throws Exception {
    BigDecimal bd1 = new BigDecimal("123456789.0123456890");

    // Create via a long
    BigDecimal bd2 = BigDecimal.valueOf(123L);

    bd1 = bd1.divide(bd2, BigDecimal.ROUND_UP);

  }
}

   
    
  








Related examples in the same category

1.BigDecimal.ROUND_DOWN
2.BigDecimal.ROUND_HALF_DOWN
3.BigDecimal.ROUND_HALF_UP
4.BigDecimal.ROUND_UP
5.new BigDecimal(String val)
6.BigDecimal: abs()
7.BigDecimal: add(BigDecimal augend)
8.BigDecimal: doubleValue()
9.BigDecimal: divide(BigDecimal divisor)
10.BigDecimal: equals(Object x)
11.BigDecimal: max(BigDecimal val)
12.BigDecimal: min(BigDecimal val)
13.BigDecimal: multiply(BigDecimal multiplicand)
14.BigDecimal: negate()
15.BigDecimal: pow(int n)
16.BigDecimal: remainder(BigDecimal divisor)
17.BigDecimal: setScale(int newScale, int roundingMode)
18.BigDecimal: subtract(BigDecimal subtrahend)
19.BigDecimal: valueOf(long val)