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