File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE?" Watch "How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE?" New topic
Author

How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE?

Prashant Neginahal
Ranch Hand

Joined: Dec 04, 2002
Posts: 76
How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE?
I mean ,
(int)Float.POSITIVE_INFINITY==Integer.MAX_VALUE gives true....?
Prashant


--------------<br />Prashant<br />SCJP-91%
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Isn't that answered here?
- Peter
Harry Kong
Ranch Hand

Joined: Dec 06, 2002
Posts: 41
When you cast Float.POSITIVE_INFINITY down to int it will be masked to Integer.MAX_VALUE. And Float.NEGATIVE_INFINITY will be masked to Integer.MIN_VALUE. And Float.NaN will be masked to 0. This also works for Double and Long.


SCJP 1.4
 
 
subject: How int of Float.POSITIVE_INFINITY in Integer.MAX_VALUE?