hello good, I wanted to be able to change the order of the bits for their correct reading.
When I want it to get a 1 in binary, it represents it to me in the following way

What I wish is for it to be positioned correctly as follows.
0000000000000001
What you have is correct. Bit 0 (array element [0]) is 1
BIT 1 1
5432109876543210
VAL 0000000000000001
If you must, then look at array reverse
Additionally, if you want it as a bit string, then call join("") on the array....

↑ obviously that was reversed first.

I got it in the following way. I have created a function to invert the bits


Thanks for your interest