List of usage examples for java.math BigDecimal negate
public BigDecimal negate(MathContext mc)
From source file:Main.java
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);/*from w w w . ja va 2s .c om*/ }