Java Data Type How to - Divide one BigDecimal from another BigDecimal


We would like to know how to divide one BigDecimal from another BigDecimal.


 //  w w  w. j  a va 2 s  .  co m

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);