//方案一:

public class Solution {

public void reOrderArray(int [] array) {
   int len=array.length;
    if(len==0)
        return;
    int start=0;


    for(int i=0;i<len;i++){
        if(array[i]%2==1){
           move(array,start,i);
            start=start+1;
        }
    }
}

public void move(int a[],int start,int end){
    int temp=a[end];
    int i=0;
    for(i=end;i>start;i--)
        a[i]=a[i-1];
    a[i]=temp;
}

}

//方案二

public class Solution {

public void reOrderArray(int [] array) {

   int len=array.length;

   if(len==0)
       return;
    int temp;

    for(int i=0;i<len;i++)
        for(int j=0;j<len-i-1;j++)
            if(array[j]%2==0&&array[j+1]%2==1)
            {
                temp=array[j];
                array[j]=array[j+1];
                array[j+1]=temp;
            }
}

}

//方案三:对方案二的稍微优化

public class Solution {

public void reOrderArray(int [] array) {

   int len=array.length;
   if(len==0)
       return;
    int temp;
    boolean flag=false;
    for(int i=0;i<len;i++){
        for(int j=0;j<len-i-1;j++)
            if(array[j]%2==0&&array[j+1]%2==1)
            {
                temp=array[j];
                array[j]=array[j+1];
                array[j+1]=temp;
                flag=true;
            }
        if(!flag)
            return;
    }
}

}

12-01 17:22