This week's book giveaway is in the Design forum. We're giving away four copies of Building Microservices and have Sam Newman on-line! See this thread for details.

Can you please explain to me why 0xFFFFFFFC = -4.0, and why 0xFFFFFFDF = -33 ? I am having difficulty learning hexadecimal, not to mention negative hexadecimal. Maybe you can recommend a good web site that explains it. Thanks, TM

the trick with hex is to turn into binary (which is actually easier to do than Decimal) -- and then figure out what that binary number is. So... we've got these 2 numbers: 0xFFFFFFFC and 0xFFFFFFDF

So... now that I've done that one for ya -- can you figure out the other? Grab a piece of scrap paper and count from 0-15 in binary and that will help you to convert the Hex digits to its binary equivalent. [ August 19, 2003: Message edited by: Jessica Sant ]

Decimal to Hex is a little trickier.. You can check out this thread for some instruction about how: http://www.coderanch.com/t/242789/java-programmer-SCJP/certification/Octal-hexadecimal-representation BUT -- the good news is, converting Decimal -> Hex is not on the exam. So look into it if you're curious... but don't sweat it. Go study Threads some more, it'll be time better spent. Bascially you should know that HEX numbers start with 0x, Octal numbers start with 0, Decimal numbers start with anything 1-9. And remember, the x in Ox can be capitalized too -- so OXDEAFCAB is the same as OxDeafCab is the same as Oxdeafcab --

In order to convert decimal to any base (hex, octal, or binary), you can continually divide the number by the base. Let me give you an example by converting the number 95 to all 3 bases. First, we'll do binary:

Now, write down the remainders in reverse order that you got them: 1011111. There you have it - 1011111 is the binary version of 95. Let's try that with hex:

Again, we write down the remainders in reverse order and we have 0x5F, which is the hexadecimal representation of 95. Finally, let's do octal:

That gives us a value of 137, which is the octal representation of 95. I hope that helps, Corey