Absolute Permutation Hackerrank Solution Java