my dog learned polymorphism
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes floatToIntBits & some others!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "floatToIntBits & some others!!" Watch "floatToIntBits & some others!!" New topic

floatToIntBits & some others!!

Deep Chand
Ranch Hand

Joined: Dec 17, 2002
Posts: 133
Hi All,
I went thru' the 1.4 api for 'Float' class but couldn't understand the purpose of following methods.
API says:
floatToIntBits(float) - Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.
Similarly, intBitsToFloat(int) method.
I know I may sound a little dumb here...but when I tried to use these functions the output I got confused me even more...any help/clue would be appreciated.
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

I think the key thing you need to read is that it has to do with the IEE754 standard. Something the majority of us will never ever ever ever (get it?) use. It deals with getting exact values with floating points or something. (Similar to strictfp).
You don't need to know it for the exam... and if you ever need to do exact floating point stuff -- you can read the IEE754 standard -- maybe you can write up an article for the JavaRanch newsletter about it.
I agree. Here's the link:
subject: floatToIntBits & some others!!
jQuery in Action, 3rd edition