![]() |
VOOZH | about |
The BigDecimal.longValue() method converts a BigDecimal object to a long value by discarding its fractional part. If the numeric value exceeds the range of long, only the lower 64 bits of the result are returned, which may lead to data loss or sign change.
Example:
1234
Explanation: "longValue()" method truncates the decimal portion (.56) and returns only the integer part as a long.
public long longValue()
This example shows how BigDecimal.longValue() behaves when the value exceeds the range of the long data type.
The Long Value of 267694723232435121868 is -9006437873208152372 The Long Value of 72111184561789104423 is -1675791733049102041
Explanation: