toByteExact

fun toByteExact(): Byte

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

Return

this BigDecimal converted to a byte.

Since

1.5

Throws

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