A hexadecimal value is an integer composed of only the following characters:
0 1 2 3 4 5 6 7 8 9
A B C D E F
a b c d e f
Note the use of the alphabetic characters to extend the decimal number digit set.
Hexadecimal values are always prefixed by a zero and X character.
The sequence carries over for the next increment when each column reaches the value F. Thus:
0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07
0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17
Hexadecimal values have a historical significance, having been used in the earliest computer systems. However, these days they are particularly useful since they map quite conveniently to the binary system. Each hexadecimal digit corresponds to four binary digits. Two hex digits map to a byte and four to a word. This is particularly useful and is evidenced by hexadecimal values being used to generate Unicode escape sequences.
There are several hexadecimal values that are useful. These are summarized in the following table:
Value | Description |
0x0 | All bits clear |
0x20 | The single bit to toggle between upper and lower case letters |
0x7F | A seven bit character mask |
0x8000 | The sign bit of a 16 bit integer value |
0x80000000 | The sign bit of a 32 bit integer value |
0xDF | A mask that excludes the upper/lower case bit |
0xFF | All bits set in a byte |
0xFFFF | All bits set in a 16 bit word |
0xFFFFFFFF | All bits set in a 32 bit word |
See also: | Decimal value, Integer constant, Number, Number.toString(), Octal value |
Prev | Home | Next |
HEAD.vAlign | Up | Hidden object |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |