toIntExact

abstract fun toIntExact(): Int

Converts this BigDecimal to an int, checking for lost information. If this BigDecimal has a nonzero fractional part or is out of the possible range for an int result then an ArithmeticException is thrown.

Return

this BigDecimal converted to an int.

Since

1.5

Throws

if this has a nonzero fractional part, or will not fit in an int.