Bit Manipulation Java Leetcode