This week's book giveaway is in the Other Languages forum.We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!

# Binary Notes

suresh kamsa
Ranch Hand
Posts: 149
All
I would like to know how to represent following in binary.
Byte.MAX_VALUE
Float.NEGATIVE_INFINITY
Float.POSITIVE_INFINITY
Short.MIN_VALUE
Short.MAX_VALUE
and many more which I missed
I need to practice because I see many questions based on those. If any java guru direct me to any notes or any url site, I appreciate it.

Jose Botella
Ranch Hand
Posts: 2120
With Integer.toBinaryString(int) you can see the bynary value for int arguments.
However it's very important that you know in two's complement the maximum positive value is formed by all but the most significant bits to one.
Byte.MAX_VALUE , 0111 1111
Short.MAX_VALUE , 0111 1111 1111 1111
etc.
And the fewer value (negative) has all to zero except the most significant.
Byte.MIN_VALUE , 1000 0000
Short.MIN_VALUE , 1000 0000 0000 0000
etc.
Please buy a book or search the web to learn about binary formats because is very important for the exam.
Hardly ever it's necessary to know the binary form of a floating point number because they are not going to tell you anything. They follow the IEEE 754 standars. Anyway, it's possible to see the binary representation via: Float.floatToRawIntBits(float) and Double.doubleToRawLongBits(double)

Venkatesh Gowri
Greenhorn
Posts: 12
Hi
I browsed the Web and found some Information on the IEEE 754 format .SOme links went to the Sun site itself.So i guess these would be a good resouce.
http://docs.sun.com/source/806-3568/index.html
http://docs.sun.com/source/816-2464/index.html
hope these Help