Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.math.BigDecimal;

public class Main {
    public static void main(String[] args) {
        BigDecimal decimalA = new BigDecimal("123456789012345");
        BigDecimal decimalB = new BigDecimal("10");

        decimalA = decimalA.add(decimalB);
        System.out.println("decimalA = " + decimalA);

        decimalA = decimalA.multiply(decimalB);
        System.out.println("decimalA = " + decimalA);

        decimalA = decimalA.subtract(decimalB);
        System.out.println("decimalA = " + decimalA);

        decimalA = decimalA.divide(decimalB);
        System.out.println("decimalA = " + decimalA);

        decimalA = decimalA.pow(2);
        System.out.println("decimalA = " + decimalA);

        decimalA = decimalA.negate();
        System.out.println("decimalA = " + decimalA);
    }
}