function to find the position of rightmost set bit . Returns - 1 if there are no set bits
function getFirstSetBitPos ( n ) { return ( parseInt ( Math . log ( n & - n ) / Math . log ( 2 ) ) + 1 ) - 1 ; }