Online Java Compiler By
JavaTpoint.com
import java.math.BigDecimal; public class BigdecimalNegateExample1 { public static void main(String[] args) { // Creating BigDecimal object BigDecimal bdValue, negatedValue; // Assign value to BigDecimal objects bdValue = new BigDecimal("5656"); //it returns negated BigDecimal value negatedValue=bdValue.negate() ; //Displaying negated value System.out.println( "Negated value "+ bdValue +" is = " +negatedValue ); } }
Output