Bit Manipulation Leetcode Questions Java