@@ -0,0 +1,761 @@
+package array2;%0A%0Aimport java.util.Arrays;%0A%0Apublic class ZeroMaxTest %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09%0A%09%09ZeroMaxTest test = new ZeroMaxTest();%0A%09%09System.out.println(Arrays.toString(test.zeroMax(new int%5B%5D %7B 0, 5, 0, 3 %7D)));%0A%09%09System.out.println(Arrays.toString(test.zeroMax(new int%5B%5D %7B 0, 4, 0, 3 %7D)));%0A%09%09System.out.println(Arrays.toString(test.zeroMax(new int%5B%5D %7B 0, 1, 0 %7D)));%0A%09%7D%0A%0A%09public int%5B%5D zeroMax(int%5B%5D nums) %7B%0A%09%09if (nums.length %3C 2)%0A%09%09%09return nums;%0A%0A%09%09int%5B%5D array = new int%5Bnums.length%5D;%0A%0A%09%09int maxOdd = 0;%0A%0A%09%09for (int i = nums.length - 1; i %3E -1; i--) %7B%0A%09%09%09if (nums%5Bi%5D %25 2 != 0 && nums%5Bi%5D %3E maxOdd) %7B%0A%09%09%09%09maxOdd = nums%5Bi%5D;%0A%09%09%09%7D%0A%09%09%09if (nums%5Bi%5D != 0) %7B%0A%09%09%09%09array%5Bi%5D = nums%5Bi%5D;%0A%09%09%09%7D else %7B%0A%09%09%09%09array%5Bi%5D = maxOdd;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return array;%0A%09%7D%0A%7D%0A

Add ZeroMaxTest