short

The primitive type "short" represents an integer number between -32 768 and 32 767. It requires 2 bytes of memory, that is 16 bits.

This data type is used very rarely. You will probably not need it. (Even if you want to store a number that fits into its range, use "int" instead, because Java would internally convert it to "int" during all mathematical calculations anyway.)

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

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