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 bg1 = new BigDecimal("40");
        BigDecimal bg2 = new BigDecimal("4E+1");

        // assign the exact int value of bg1 and bg2 to i1,i2 respectively
        int i1 = bg1.intValueExact();
        int i2 = bg2.intValueExact();

        // print i1,i2 values
        System.out.println(i1);
        System.out.println(i2);
    }
}