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.
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)