in reply to understanding if conditions

& is the bit bit operator == is the logical operator for compare The first if check if the bit of position $j was setted in $i. The second checsk if $i is 2**$j