String permutation finder impl in java