Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compare BigDecimal movePointRight and scaleByPowerOfTen in Java

import java.math.BigDecimal;
public class Demo {
	public static void main(String... args) {
		long base = 3676;
		int scale = 5;
		BigDecimal d = BigDecimal.valueOf(base, scale);
		System.out.println("Value = "+d);
		System.out.println("\nDemonstrating moveRight()...");
		BigDecimal moveRight = d.movePointRight(12);
		System.out.println("Result = "+moveRight);
		System.out.println("Scale = " + moveRight.scale());
		System.out.println("\nDemonstrating scaleByPowerOfTen()...");
		BigDecimal scaleRes = d.scaleByPowerOfTen(12);
		System.out.println("Result = "+scaleRes);
		System.out.println("Scale = " + scaleRes.scale());
	}
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.