0.set total=0
1. set var=1
2. look at the rightmost binary digit and if it=1 add var to total
3. repeat 2, but each time look one more digit to the left and multiply var by 2
1. set var=1
2. look at the rightmost binary digit and if it=1 add var to total
3. repeat 2, but each time look one more digit to the left and multiply var by 2