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.000");
        BigDecimal bg2 = new BigDecimal("12300");

        BigDecimal bg3 = bg1.scaleByPowerOfTen(3);
        BigDecimal bg4 = bg2.scaleByPowerOfTen(-3);

        String str1 = bg1 + " raised to 10 power 3 is " + bg3;
        String str2 = bg2 + " raised to 10 power -3 is " + bg4;

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