You need value at the bit position. means a binary value rt?
this is possible using bitwise shift operator.
suppose I is your integer and you need to get its Nth bit value.
this possible by following steps
a = right shift I by (N-1)
b = right shift I by N
c = Left shift b by 1.
R = a XOR c;
R is your Nth Bit value in binary. either 1 or 0
c function may look liek below
int GetBit( int I, int N)
{
int a = I >> ( N - 1);
int b = I >> N;
b = b << 1;
int r = a ^ b;
return r;
}
and this will not work only for N = 32.
that logic you need to write seprate.
Hope this is what you are looking for