import java.util.*;
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param array int整型一维数组 * @return int整型一维数组 */ public int[] reOrderArray (int[] array) { int size = array.length; int[] odd = new int[size]; int index1 = 0; int[] even = new int[size]; int index2 = 0; for(int i = 0;i < size;i ++){ if(array[i] % 2 == 1) { odd[index1 ++] = array[i]; }else if(array[i] % 2 == 0){ even[index2 ++] = array[i]; }
}
for(int i = 0;i < index1;i ++){
array[i] = odd[i];
}
for(int i = 0;i < index2;i ++){
array[index1 + i] = even[i];
}
return array;
// write code here
}
}