Bit Manipulation Java Leetcode Longest