Search Discussion-Lab

Thursday, May 26, 2011

Byte - Basic concept & simple implementation

According to computer science Byte is combination of two words "By eight". Why eight comes? Read throughly, you will be known of this later. You have seen files saved in hard disc or any memory card. What are these files what are they contain of? Files are a series of numbers like 1, 2, 100, 7, ... ... etc. These numbers take place one after another and makes a file. File size depends on how many numbers of numbers they cosist of. Now, what are these numbers. Simply, these are Bytes. If a file has 5 bytes like 10, 19, 105, 10 and 2 it will be 5 bytes long. If a file has 1024 bytes it will be 1 killow bytes long. As like as
QuantityUnit
1024 B1 KB
1024 KB1 MB
1024 MB1 GB
1024 GB1 TB
725 B0.71 KB

A byte can have a value from 0 to 255 total 256 values. As most computer processor works on 2 base calculation, bytes are calculated by base 2, Binary. As you know binary numbers charecter can be only 0 and 1 these are called bit. Computer processor calculates 1 as true or yes or circuit connected 0 as, false or no or circuit disconnected. So,
DecimalBinary
100000001
200000010
1000001010
10501101001
25511111111

Did you noticed I have used 8 digits to express a binary number. Here is the reson of "By eight". A number between 0 to 255 is maximum 8 bit long in binary. So they are called "Byte". Now you have to know more advanced. If you go to working practically you will face a problem. You will find negetive byte value like -1 or -50. As I have told bytes can have values 0 to 255 that isn't incorrect in hexadecimal or binary but incorrect in decimal. Actualy byte values sequence is like this

0, 1, 2, 3, ... ... 126, 127, -128, -127, -126, ... ... -3, -2, -1

Here are 256 values.

ValuesTotal
01
1 to 127127
-128 to -1128
All total:256

But in hexadecimal or binary these values are like
DecimalHexadecimalBinary
10x0100000001
-10xFF11111111
730x4901001001
-990x9D10011101

Now you can have a simple glimpse how bytes in file used. If you want to express a text charecter like "A" in a file there is a byte with value 65. Another charecter like "¤" contains two bytes 194 (-62) and 164 (-92). You can see more byte values of text charecter surfing the internet. Another usage in image files to express colors in RGB or ARGB. Now you know the basics of bytes. Everithing nowadays like video, text, image, sound can be express within bytes in a file concept.