Offer21.调整数组顺序使奇数位于偶数前面/Solution.java
class Solution {
    public int[] exchange(int[] nums) {
        int odd = 0, even = nums.length - 1, tmp;
        while (odd < even) {
            while (odd < even && (nums[odd] & 1) == 1) odd++;
            while (odd < even && (nums[even] & 1) == 0) even--;
            tmp = nums[odd];
            nums[odd] = nums[even];
            nums[even] = tmp;
        }
        return nums;
    }
}