标签:
1 public class Solution { 2 public void reOrderArray(int [] array) { 3 int length = array.length ; 4 int[] temp = new int[length] ; 5 if(length==1||length==0||array==null){ 6 return ; 7 } 8 int j = 0 ; 9 for(int i = 0 ;i<length ;i++){ 10 if((array[i]&1)==1){ 11 temp[j] = array[i] ; 12 j++ ; 13 } 14 } 15 for(int i = 0 ;i<length ;i++){ 16 if((array[i] & 1)==0){ 17 temp[j] = array[i] ; 18 j++ ; 19 } 20 } 21 for(int i = 0 ;i<length ;i++){ 22 array[i]=temp[i] ; 23 } 24 25 } 26 }
标签:
原文地址:http://www.cnblogs.com/huntertoung/p/4765153.html