Details About How Numbers are Stored

The number 300 in the binary system is: 100101100. This takes up 9 bits. A byte can only hold 8 bits so we have a problem. Also one of those 8 bits is used to indicate whether the number is positive or negative. So only the last 7 bits can be stored for a positive number in a byte. So only 0101100 gets put in the variable. That binary number in decimal form is 44.

The number 4294983648L in the binary system is: 100000000000000000011111111100000. This takes up 33 bits. An int can only hold 32 bits so we have a problem. Also one of those 32 bits is used to indicate whether the number is positive or negative. So only the last 31 bits can be stored for a positive number in an int. So only 0000000000000000011111111100000 gets put in the variable. That binary number in decimal form is 16352.