Reputation: 3809
how do I get the leftmost 8bits of array?
byte[] buf = new byte[] { 0x83, 0x00, 0xEE, 0x03, 0x26, 0x6D, 0x14, 0x00, 0xF1, 0x65, 0x27, 0x00, 0x19, 0x02, 0xD8, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDB, 0xD7, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x41, 0x00, 0x64, 0x00, 0xE4, 0x00, 0x00, 0x00, 0xDD, 0x0A, 0x18, 0x19, 0x00, 0x00, 0x79, 0x91, 0x87, 0x00, 0x00, 0x01, 0x00, 0xA8, 0x02, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x34, 0x00, 0x6A, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0A, 0x7E, 0x42, 0x6C, 0x75, 0x65, 0x57, 0x61, 0x76, 0x65, 0x7E, 0x00, 0x09, 0x42, 0x6C, 0x61, 0x63, 0x6B, 0x44, 0x75, 0x73, 0x74 };
are the leftmost 8bits are buf[0]
and the rightmost 8bits are buf[buf.Length]
? or how do i get it? thanks.
Upvotes: 0
Views: 209
Reputation: 7319
1 byte = 8 bits.
In the usual case, an array is a linear, contiguous block of memory. So strictly speaking, an array typically points to the first block in allocated memory space.
Leftmost (smallest index) element in array is leftmost element in memory, i.e. order is the same.
Answer: buf[0]
Upvotes: 1