I have an array `a=[0 1 0 1 1 0]` and I would like to turn the content of that array into a number ( `a=010110` ). How do I do that?

And I would also like to to the opposite:
 if I have a number `b=100101`, I would like to get an array `a=[1 0 0 1 0 1]`

Thanks for help