the code below should return true for input n=10 and k =3 but it is giving false,
it's as if while execution it is ignoring if part,it is getting executed if I comment the else part
class CheckBit
{
// Function to check if Kth bit is set or not.
static boolean checkKthBit(int n, int k)
{
// Your code here
boolean a;
String bina=Integer.toBinaryString(n);
char aa=bina.charAt(k);
if(aa==1){
a=true;
}
else {
a=false;
}
return a;
}
}