0

# How do you do binary?

ClintonHinerman

Lvl 1
2012-11-23 00:40:46

In binary code there are only two possible characters: 1 and 0. These two characters are basically yes and no. 1 means true, and 0 means false.

Every letter or number is represented by 8 digits, also known as 8 bits. For example, the number 23 in binary code would be 00010111, 8 digits/bits. Each digit is a bit.

Once you understand that, you can move on to reading binary code.

Each of the 8 bits have a value. The rightmost number always represents 1. The next number on the left represents 2. The next number is 4. Next number is 8. In case you didn't notice, the value keeps multiplying by 2. Here is what each number represents:

0128 064 132 016 18 04 12 01

Where there is a 0 it means to ignore that value. However, wherever there is a 1, you must add that value to the total.

So, for the binary number above, you find where the 1s are, and then you add them together.

There is a 1 at 32, 8, and 2. This means you add 32, 8, and 2 together, and get 42.

Thus, 00011010 represents 26. 26 is a decimalcharacter.

The more commonly used text format is ASCII, which is just normal text and symbols like "\$#@%(".

Decimal characters are numbers. To convert binary code to ASCII, you must first convert it to decimal, like we did above. Now that we have 42, we must find out what it is in ASCII.

The decimal numbers 65-90 represent upper-case, where "A" is 65, "B" is 66, so on.

The decimal numbers 97-120 represent lower-case a-z, where "a" is 97, "b" is 98, etc.

42 is not 65-90 or 97-120. This means it is a symbol/special character. To find what a certain symbol is in decimal, then you need to to search the web. 42 is a *.

An easier way to do this, is that if the binary number starts with 011, then you know that this is a lower-case letter. If t it starts with 010, that means it is an upper-case letter. After reading these first three digits, you just determine the other 5 digits separately, and whatever number you get for the 5 digits, is the place in the alphabet that the letter is. For example, if the 5 digits added up to 4, the letter would be d.

Try decoding the message below. The 00100000 is a space.

01001110 01101001 01100011 01100101

00100000

01001010 01101111 01100010

Hopefully, now you understand reading binary code. Finally, this is how to write binary code.

If you are writing a number, then do the following:______________________________________

We'll use 57 as an example here. Starting at the leftmost digit in the binary number, check if your number is equal to or greater than the value that this digit represents. If this is the 8th digit from the right, it represents 128. If your number is greater or equal to it, then you put a 1 and subtract the value from your number. Otherwise you put a 0. Then you go to the next number and do the same. Keep repeating until your number is subtracted to 0.

57 is not greater than 128, so we put a 0 here and go to the next digit, which would represent 64.

57 is not greater than 64, so we put a 0 again and go to the the next digit, representing 32.

57 is greater than 32, so we put a 1 here and subtract 32 from 57 which is 25. Next digit, 16.

25 is greater than 16, so we put a 1. Then 25 - 16 = 9. Next digit is 8.

9 is greater than 8, so we put a 1. 9 - 8 = 1. Next digit is 4.

1 is not greater than 4. Put 0. Next digit, 2.

1 is not greater than 2. Put 0. Next digit, 1.

1 is equal to 1 so we subtract one and now we have 0. Put a 1.

In the end, we get 00111001.______________________________________

For a letter it's almost the same thing:

If it is an upper-case letter, then you start with 010. If it is lowercase, then start with 011.

Then you just determine the other 5 digits based on the position of the letter in the alphabet. These 5 digits would represent 16, 8, 4, 2, and 1.

There is no 128, 64, and 32 because those 3 values were in the first 3 digits, which we eliminated.

If the letter was "a", which is the 1st letter in the alphabet and a vowel, then we would start with 011. Then we would keep comparing 1 with values and putting 0s, until we got to the last digit, and finally put a 1. The result would be 01100001.

______________________________________

I hope I helped. Good luck.

Emma Goldner

Lvl 9
2023-01-29 18:46:54
Study guides

20 cards

➡️
See all cards
3.81
2270 Reviews