More Than Five
More Than Five

Reputation: 10429

Get the integer from BigDecimal

If I have a BigDecimal with value 6.54, how do I convert that to an integer value of 654? i.e. no decimal point.

intValue() will just convert to 6.

Upvotes: 6

Views: 603

Answers (1)

Louis Wasserman
Louis Wasserman

Reputation: 198471

BigDecimal.unscaledValue() will return a BigInteger with the value 654. You could then call intValue() to convert that to an int, if you needed that specifically.

Upvotes: 12

Related Questions