Java BigDecimal.negate()
Syntax
BigDecimal.negate() has the following syntax.
public BigDecimal negate()
Example
In the following code shows how to use BigDecimal.negate() method.
//from ww w . j a va 2 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.