Like C/C++ have the INT_MAX macro (#include<limits.h>) to set a variable to INFINITY.
I was wondering if there is a similar function/macro in JAVA. I want to set an integer variable to INFINITY.
Thanks in advance !!
The static MAX_VALUE variable of the Integer class is what you want.
Integer.MAX_VALUE
However, this isn't as useful in Java, since int values in Java are 32 bits no matter what.
Go to the following web page to learn more about the Integer class:
https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With