## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

# what number does this represent 00000011

what number does this represent 00000011 Here's one way to decode binary numbers. Make a column for each digit, and starting from the right, put a "1" and then as you move left put double the value of the column next to it. Remember, right-to-left ( THIS WAY ). You'll get something like this, which is a horizontal version of the helper table shown in the quiz:

```128  64  32  16   8   4   2   1   <-- 8 columns for 8 digits
```

Then, put your binary number on the next line, spread into the columns. Now below that, multiply each top number by the binary digit and put the result below. It's easy, since binary digits are either 1 or 0, so you either put the number on top again or zero.

Then finally, add up all the numbers on the bottom row and that's your answer. Like this:

```128  64  32  16   8   4   2   1   <-- starting columns
0   0   0   0   0   0   1   1   <-- multiply by your binary digits
--- --- --- --- --- --- --- ---
0   0   0   0   0   0   2   1   <-- add these up:  2 + 1  =  3
```

Also, since zeros in front don't count you can skip them. So in this case we really only needed 2 columns.

If your unsure at anytime, simply google something like 'decimal to binary converter' then you can convert any binary number to decimal. What about Horner's method? :) From left to right 0*2+current number=current result -> current result*2+current number ... to n

My ruby realization:

```class Integer
def to_dec
if is_a?(Integer)
abort "It is not a binary number!" unless !to_s.match(/[^01]/)
to_s.chars.map(&:to_i).inject { |memo, item| memo*2 + item }
else
"It is not a number!"
end
end
end
```