Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.math.BigDecimal;
import java.math.BigInteger;

public class Main {

    public static void main(String[] args) {

        BigDecimal bg1 = new BigDecimal("123.12");
        BigDecimal bg2 = new BigDecimal("-245.67");

        // assign unscaledValue of bg1,bg2 to bi1,bi2
        BigInteger bi1 = bg1.unscaledValue();
        BigInteger bi2 = bg2.unscaledValue();

        String str1 = "The Unscaled Value of " + bg1 + " is " + bi1;
        String str2 = "The Unscaled Value of " + bg2 + " is " + bi2;

        System.out.println(str1);
        System.out.println(str2);
    }
}