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("123.67");
        BigDecimal bg2 = new BigDecimal("1234567890987654");

        // assign the long value of bg1 and bg2 to l1,l2 respectively
        long l1 = bg1.longValue();
        long l2 = bg2.longValue();

        System.out.println(l1);
        System.out.println(l2);
    }
}