You are printing the elements twice. For example element at index 3. you print it in second position when b6 is 2; and on the next line, when b6 is 3, you print it again in first position.