Partition Array by Odd and Even

Source

Partition an integers array into odd number first and even number
second.

Example
Given [1, 2, 3, 4], return [1, 3, 2, 4]

Challenge
Do it in-place.

Java

public class Solution {
    /**
     * @param nums: an array of integers
     * @return: nothing
     */
    public void partitionArray(int[] nums) {
        int start=0;
        int end = nums.length-1;

        while(start<=end){
            if(nums[start]%2!=0){
                start++;
            }
            else{
                swap(nums, start, end);
                end--;
            }
        }
    }

    public void swap(int[] nums, int left, int right){
        int tmp = nums[left];
        nums[left] = nums[right];
        nums[right] = tmp;
    }
}