Hexadecimal is a numeral system in base 16 (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F).
To see binary data in hexadecimal form, you use an hex editor.
Hexadecimal is more compact to write than binary. For example, the binary number 100110110100 is 9B4 in hexadecimal.
Hexadecimal numbers in text are specified with a prefix
Language | Prefix | Note |
---|---|---|
C / Java | 0x | 0x1 0x01, 0x001, and 0x0001 are all the same |
Pascal | $ | |
HTML | # |
Windows calculator, in Programmer mode, to see and convert:
Decimal to Binary to Hexadecimal
function numberRepresentation(decimal, binary, hexadecimal) {
this.decimal = decimal;
this.binary = binary;
this.hexadecimal = hexadecimal;
}
numbers =[]
for (var i=0;i<=16;i++) {
numbers.push(
new numberRepresentation(
i,
i.toString(2),
i.toString(16).toUpperCase()
)
);
}
console.table(numbers);