I have a app in vb.net that I am doing maintenance on and as always not enough documentation.

The app is for a Human Machine Interface that uses a visioning system to look for pins when a curcuit board is placed in a ficture. When the value comes out of the PLC the leading 3 bits must be set to 0 and the result is compared to a value in a DB table.

I used a BitArray and a StreamWriter to come up with a string rep of the number 47;

'0000000000101111'

I know that the MSB is at pos 11.

I want to set the bit mask in the form 'And 2 ^ x'.

How do I compute x?

Or am I going about this the wrong way.