Count set bits of X
while ( X != 0 ) { X = ( X - 1 ) & X ; count ++ ; } if ( count % 2 == 0 ) { System . out . print ( even + " ▁ " + odd + "NEW_LINE"); } else { System . out . print ( odd + " ▁ " + even + "NEW_LINE"); } } }