I assume you know what a byte is. A byte array is just a memory area containing a group of adjacent (side by side) bytes, so it makes sense to talk about them in order: the first byte, the second byte, etc.
Just as bytes can encode different types and ranges of data (digits from 0 to 255, numbers from -128 to 127, single characters using ASCII, for example, βaβ or β%β, CPU codes), each byte in an array of bytes can be any of these things or contribute to some multibyte values, such as numbers with a wide range (for example, a 16-bit unsigned int from 0..65535), international character sets, text strings ("hello") or part / all compiled computer programs.
The important thing about a byte array is that it gives indexed (fast), accurate, raw access to every 8-bit value stored in this piece of memory, and you can control these bytes to control each individual bit. The bad news is that the computer simply treats each record as an independent 8-bit number, which may be related to your program, or you may prefer some powerful data type, such as a string that tracks its own length and grows as needed. or a floating point number that allows you to store the value of 3.14 without thinking about the broken representation. As a data type, it is inefficient to insert or delete data near the beginning of a long array, since all subsequent elements must be shuffled to create or fill the created / necessary gap.
user433534 Oct 26 '10 at 1:14 2010-10-26 01:14
source share