jioy uilo

Greenhorn

Posts: 25

Lawrence Chettiar

Ranch Hand

Posts: 62

posted 14 years ago

Now you know that the Long.MAX_VALUE is a max postive no that means all the bit will be 1 except the MSB (most significant bit) so you know only 1st bit is zero rest is 1. Now how may bits are in Long (64) i.e in hex we have 64/4 (one hex digit will use 4 bits) so you have 16 hex digits now all the but first will not be f as four 1111(bits) will be f.

So will have 15 f's vis(fffffffffffffff)

now for the left 4 bits which are 0111 which is

7 in hex so the end value will be

7fffffffffffffff (7 and 15 f's)

Well this is my way of calculating hope this help you

So will have 15 f's vis(fffffffffffffff)

now for the left 4 bits which are 0111 which is

7 in hex so the end value will be

7fffffffffffffff (7 and 15 f's)

Well this is my way of calculating hope this help you

SCJP 1.4 (86%)<br />SCMAD Beta (77%)<br />SCEA (part I:89%,partII:93%)<br />MCAD (cleared 70-315 & 70-320 [Score 980])

Dan Chisholm

Ranch Hand

Posts: 1865

posted 14 years ago

Thank you Lawrence.

jioy,

Your question is frequently asked so I put the answer on a Maximum Value Tutorial page. The Base Conversion Tutorial might also be helpful.

jioy,

Your question is frequently asked so I put the answer on a Maximum Value Tutorial page. The Base Conversion Tutorial might also be helpful.

Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>