example how to convert/print binary to decimal (1) your binary number 1 0 1 1 0 1 0 1, saved in an int[] array (2) build a table for binary bit as following: 1 x 2 4 x 8 16 x 32 x 64 128 x notice the 'x' indicating a particular binary bit should be added in the later step (3) add the right most decimal digits marked with 'x', you got 1+4+6+2+8= 21, add this line to the table, you got 1 x 2 4 x 8 16 x 32 x 64 128 x ------------------------- 21 x (4) add the second rightmost decimal digits (mared with 'x') of the above table you got 1+3+2+2=8, add a new line 1 x 2 4 x 8 16 x 32 x 64 128 x ------------------------- 21 x ------------------------- 8 (5) do the same for the thrid rightmost digit, you got 1 x 2 4 x 8 16 x 32 x 64 128 x ------------------------- 21 x ------------------------- 8 x ------------------------ 1 x (6) for this example, we stop here, and the final result is 181 as showed in the table.