Java tutorial
import java.math.BigDecimal; public class Main { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("123.123456"); // set scale of bg1 to 6 in bg2 BigDecimal bg2 = bg1.setScale(6); String str = "The value of " + bg1 + " after changing the scale to 6 is " + bg2; System.out.println(str); } }