Long.MAX_VALUE
is 9,223,372,036,854,775,807
.
If you were executing your function once per nanosecond, it would still take over 292 years to encounter this situation according to this source.
When that happens, it’ll just wrap around to Long.MIN_VALUE
, or -9,223,372,036,854,775,808
as others have said.