Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn Tunji
540 PointsWhat number is represented by the byte 00001000?
10
3 Answers
Steven Parker
231,288 PointsClick this link to see the answer I gave to someone asking the same question back in 2017.
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 PointsHi John Tunji,
Understanding binary can be a bit tricky.
00001000
first off: You're counting left to right
two: You start at the place of the first 1 you see.
the 1 is in the eights place, which means that number produced by the byte can't be less than eight
(specifically it'll be between 8 and 15, but the value of the bit in the eights place is 8)
then you check the value of the bit in the fours place
(if it too is 1, then you add the value of the fours place, which is 4 to 8)
(otherwise, you add 0 to 8)
and so your running total is 8 + 0 = 8
then you check the value of the bit in the twos place
(if it too is 1, then you add the value of the twos place, which is 2 to the running total)
(otherwise, you add 0 to the running total)
and so your running total is 8 + 0 = 8
then you check the value of the bit in the ones place
(if it too is 1, then you add the value of the ones place, which is 1 to the running total)
(otherwise, you add 0 to the running total)
and so your running total is 8 + 0 = 8
the entire equation would look like this: 8 + 0 + 0 + 0 = 8
Hope that helps make it easier to understand.