This week's book giveaway is in the Java in General forum.We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!

# what will be the size of 0x1f400000L in MB

chandrakanth boga
Ranch Hand
Posts: 49
Hi ,

Please tell me what will be the size of long in MB ...
what will be the max size of long...
what will it be 0x1f400000L if converted to MB

Peter Chase
Ranch Hand
Posts: 1970
Sounds like attempt to get someone to do his homework, so I'm not giving a direct answer and hope others won't either.

1MB, meaning a megabyte, is usually 1024*1024 bytes. Occasionally, people have been known to re-define megabyte as 1000*1024 bytes, or even 1000*1000 bytes. This practice seems to be most common amongst storage device manufacturers, since it allows them to claim higher capacity.

A Java long is a 64-bit signed two's complement integer.

Stefan Wagner
Ranch Hand
Posts: 1923
Hm. M is a international standardized way to express Mega which is one Million which is 1000*1000.
IT-folk created their own convention by translating Mega to 1024*1024 but that's not correct.
Today we have MiB to express 1024*1024.
here is a more detailed information: http://en.wikipedia.org/wiki/MiB

For homework I would use a comment to show I'm aware of the 1024*1024-habit - perhaps the teacher never heared of mebibyte before.

Jim Yingst
Wanderer
Sheriff
Posts: 18671
I'm not even sure what's really being asked here. Another interpretation is that the size of a long is 8 bytes, period. (It could theoretically be more on some implementations, but that seems extremely unlikely.) It takes 8 bytes to store a value like 0x1f400000L. If you want to convert that to MB, go ahead...