sorena
sorena

Reputation: 3

how to negative bigdecimal's value in android

i have a Big Decimal like this for example. i want to negative it's value. it has a string.

String a = "65";
BigDecimal example = new BigDecimal(a);
//i want to have (-65)

Upvotes: 0

Views: 371

Answers (1)

sinclair
sinclair

Reputation: 2861

BigDecimal.negate()

String a = "65";
BigDecimal example = new BigDecimal(a);
System.out.println( example.negate() ); // prints -65

Upvotes: 3

Related Questions