Maximum Swap Leetcode Problems Java