A bit is the number one (1) or zero (0). A group of eight bits makes a byte.
# Bits | Bit Patterns | # Possible Patterns |
---|---|---|
1 | 0 1 | 2 |
2 | 00 01 10 11 | 4 |
3 | 000 001 010 011 100 101 110 111 |
8 |
1 bit = 2 patterns, 3 bits = 8 patterns, ... 8 bits = 256 patterns. 2^n patterns. 1 byte = 8 bits = 256 patterns.
Hexadecimal is a different way to display binary data. 0x41 = 0b01000001 = 'A' = 65 (decimal).
The table below shows a sequence of 4 bytes with the values interpreted as a hexadecimal number, a decimal number,an ASCII character, and in the binary format (different bases). Binary base is 2, decimal base is 10, hexadecimal base is 16.
Location: | 0 | 1 | 2 |
---|---|---|---|
Value as HEX: | 0x4b | 0x4c | 0x4d |
Value as DEC: | 75 | 76 | 77 |
Value as ASCII: | K | L | M |
Value as BIN (byte): | 01001011 | 01001100 | 01001101 |
Data is typically transmitted between two computers as bytes. A buffer (or array list) is a group of bytes. Represented in hexadecimal, a group of bytes could be: FF F0 0F 11. Working with Bytes
byte data[] = { 0xFF, 0xF0, 0x0F, 0x11 };
// identical: { 255, 240, 15, 17 };
// identical: { B11111111, B11110000, B00001111, B00010001 };
Sitemap | Copyright © 2017 - 2025 Mechatronic Solutions LLC
Web site by www.MechatronicSolutionsLLC.com | | 2.3710 ms