两个while循环的判断条件不能单纯的写array[i]%2!=0(array[j]%2==0),要考虑到极端情况,就是当数组都是奇数(偶数)时。调整后可能是:[1, 5, 3, 4, 2, 6]或者为[1, 3, 5, 6, 4, 2]当数组int[] array = {1,3,5,7,9}时。当数组int[] array = {1,3,5,7,9}时。当数组int[] array = {2,4,6,8}时。当数组int[] array = {2,4,6,8}时。如数组:[1,2,3,4,5,6]