The following is a table showing the difference between unsigned, signed, hexadecimal, and binary representations of the possible numbers in a 4-bit int.
unsigned | signed | hex | binary | sign bit |
---|---|---|---|---|
0 | 0 | 0 | 0000 | 0 |
1 | +1 | 1 | 0001 | 0 |
2 | +2 | 2 | 0010 | 0 |
3 | +3 | 3 | 0011 | 0 |
4 | +4 | 4 | 0100 | 0 |
5 | +5 | 5 | 0101 | 0 |