toLongExact

fun toLongExact(): Long

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

Return

this BigDecimal converted to a long.

Since

1.5

Throws

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