public long longValueExact ()

Converts this BigInteger to a long, checking for lost information. If the value of this BigInteger is out of the range of the long type, then an ArithmeticException is thrown.

Returns:  this BigInteger converted to a long.

ArithmeticException    if the value of this will not exactly fit in a long.

See also:

Since:  1.8