BigDecimal.negate() has the following syntax.
public BigDecimal negate()
In the following code shows how to use BigDecimal.negate() method.
//from w ww. j av a2 s . c om import java.math.BigDecimal; public class Main { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("12.1234"); BigDecimal bg2 = bg1.negate(); System.out.println(bg2); } }
The code above generates the following result.