Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.math.BigDecimal;
import java.math.MathContext;

public class Main {

    public static void main(String[] args) {

        BigDecimal bg1 = new BigDecimal("143.145");
        BigDecimal bg2 = new BigDecimal("10.01");

        MathContext mc = new MathContext(2);

        BigDecimal bg[] = bg1.divideAndRemainder(bg2, mc);

        System.out.println("Quotient is " + bg[0]);
        System.out.println("Remainder is " + bg[1]);
    }
}