int

The primitive type "int" represents an integer number between -2 147 483 648 and 2 147 483 647. It requires 4 bytes of memory, that is 32 bits.

This is the most frequently used integer type, and you should use it always when you are sure that a range of two billions will be enough.

This is how values are stored in the memory: Each bit has a specified value. Value of the whole "int" is the sum of the values of active bits. Note the negative value for the highest bit.

BitValue
31.-2 147 483 648
30.1 073 741 824
29.536 870 912
28.268 435 456
27.134 217 728
26.67 108 864
25.33 554 432
24.16 777 216
BitValue
23.8 388 608
22.4 194 304
21.2 097 152
20.1 048 576
19.524 288
18.262 144
17.131 072
16.65 536
BitValue
15.32 768
14.16 384
13.8 192
12.4 096
11.2 048
10.1 024
9.512
8.256
BitValue
7.128
6.64
5.32
4.16
3.8
2.4
1.2
0.1

viliam@bur.sk