1.

Big Decimal negate value

Answer»

Use the Big Decimal NEGATE() method to negate a BigDecimal value in Java.
Let us see a simple example:

import java.math.*; PUBLIC class Example {   public static void main(String[] ARGS) {      BigDecimal b1, b2;      b1 = new BigDecimal("879879");      b2 = b1.negate();      System.out.println("NEGATED = " +b2);   } }

The OUTPUT:

Negated = -879879


Discussion

No Comment Found