Permutation Leetcode Solution Java