I tried a little combination with output like -> no space after last number, but it's not validate still. Maybe you'll see what I don't and in that time I check other help question and think what that it'll would be. I print it from new list
List <Integer> list = new ArrayList<>();
becouse before that printing result from HashMap (with space after last number), I can't validate too.