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

This content was proof-read by Grammarly. You can Try Grammary for FREE

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: