Java – How to Divide BigDecimal value from another in Java ?

Problem Statement

You want to divide one BigDecimal value from another in your Java program.


Use the divide() instance method defined in the BigDecimal class as shown below.

import java.math.BigDecimal;

public class Main {

    public static void main(String[] args) {

        System.out.println(" Java Tutorials");
        BigDecimal input1 = new BigDecimal(10102);
        BigDecimal input2 = new BigDecimal(1090);

        BigDecimal output1 = input1.divide(input2);

%d bloggers like this: