October 12, 1999 - Binary and Hexadecimal Notations | WebReference

October 12, 1999 - Binary and Hexadecimal Notations

Yehuda Shiran October 12, 1999
Binary and Hexadecimal Notations
Tips: October 1999

Yehuda Shiran, Ph.D.
Doc JavaScript

Bitwise operators in JavaScript are the operators used in bit-oriented operations. A bit is the smallest unit of information, usually represented by 0 or 1 specifications. Bit manipulations are used to control the machine at the lowest level. In JavaScrip, you won't be using bitwise operators to control the machine at a low level but rather for other purposes such as encrypting and encoding.

Eight consecutive bits form a byte. There are 256 (28) byte variations. That is, a byte can be one of 256 eight-bit sequences. For example, 11010001 is one of these 256 possibilities. Programming languages that support character data types, such as C, C++, and Pascal, use a single byte to represent one character.

Hexadecimal notation is convenient for representing binary data because each hexadecimal digit represents four binary bits. The following table lists the hexadecimal values from 0 to F, along with the equivalent binary values:

HexBinaryHexBinary
0000081000
1000191001
20010A1010
30011B1011
40100C1100
50101D1101
60110E1110
70111F1111