Java tutorial
import java.math.BigDecimal; import java.math.MathContext; public class Main { public static void main(String[] args) { MathContext mc = new MathContext(4);// 4 precision // assign value to bg1 BigDecimal bg1 = new BigDecimal("123.1234"); // assign negate value of bg1 to bg2 using mc BigDecimal bg2 = bg1.negate(mc); System.out.println(bg2); } }