Languages
[Edit]
EN

Java - get long min value

2 points
Created by:
Root-ssh
178290

Short solution:

Java Long min value is -9,223,372,036,854,775,808

Short solution to get long max value:

Java Long max value is  9,223,372,036,854,775,807

1. Different ways of how to get Long min value

Edit
  • Using build-in Long.MIN_VALUE
  • Using Math power() method eg: (long) Math.pow(2, 63) + 1
  • Using bit shifting eg: -1L << 63
  • Using bit shifting and not eg: ~(~0L >>> 1)

Output:

2. Long minimum value overflow example

Edit

Output:

 

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Java - numbers operations

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join