My Simple Java Solution
````\nclass Solution {\n    public int[] sortArrayByParity(int[] A) {\n        int[] arr = new int[A.length];\n        int begin = 0;\n        int end = A.lengt
````\nclass Solution {\n    public int[] sortArrayByParity(int[] A) {\n        int[] arr = new int[A.length];\n        int begin = 0;\n        int end = A.length - 1;\n        for(int i = 0;i < A.length;i++){\n            //[3,1,2,4]\n            if(A[i] % 2 == 0){\n                arr[begin++] = A[i];\n            }else{\n                arr[end--] = A[i];\n            }\n        }\n        return arr;\n    }\n}
[]