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