
Patrick B. answered 10/19/20
Math and computer tutor/teacher
Assuming the bits are in an array, high bit at index zero (in-dion)
128*a[0] + 64 *a[1]+ 32*a[2] +16*a[3]+8*a[4]+4*a[5]+2*a[6]+a[7]
if it is backwards (end-ion), then simply reverse the order of the indexes
beginning with 7 and ending with zero.
this will get you the decimal., call it X
then to change to octal, you will need the mod operator %
X/64 is the first octal digit and then x % 64 is the remainder, R
with the remainder R, do R/8 to get the 2nd octal digit, and r%8 to get the 3rd
for example x=100 ---> 100/64 = 1 with remainder 36.
then 36/8 = 4 with remainder 4, so the octal equivalent is 144