Build Array From Permutation Solution In Java