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("1234");

        // assign a larger value to bg2
        BigDecimal bg2 = new BigDecimal("123456789098765");

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

        System.out.println(i1);
        System.out.println(i2);
    }
}