Java Data Type Tutorial - Java BigDecimal .divideToIntegralValue (BigDecimal divisor)








Syntax

BigDecimal.divideToIntegralValue(BigDecimal divisor) has the following syntax.

public BigDecimal divideToIntegralValue(BigDecimal divisor)

Example

In the following code shows how to use BigDecimal.divideToIntegralValue(BigDecimal divisor) method.

/*w w w .j a va  2  s  .c  o m*/
import java.math.BigDecimal;

public class Main {

  public static void main(String[] args) {

    BigDecimal bg1 = new BigDecimal("9.8");
    BigDecimal bg2 = new BigDecimal("3");

    BigDecimal bg3 = bg1.divideToIntegralValue(bg2);

    System.out.println(bg3);
  }
}

The code above generates the following result.