I saw in MSDN documents that the maximum value of Int32
is 2,147,483,647
, hexadecimal 0x7FFFFFFF
.
I think, if it's Int32
it should store 32-bit integer values that finally should be 4,294,967,295
and hexadecimal 0xFFFFFFFF
.
My question is why Int32
stores 31-bit integer values?
It's because it's a signed integer. An unsigned 32-bit integer give you the value you expect.
Check out this MSDN page - http://msdn.microsoft.com/en-us/library/exx3b86w(v=vs.80).aspx
For a more in depth explanation on why this is check out the link in Jackson Popes answer related to Two's Complement number representation.
Also some further reading.