@@ -0,0 +1,573 @@
+package array2;%0A%0Apublic class TwoTwoTest %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%0A%09%09TwoTwoTest test = new TwoTwoTest();%0A%09%09System.out.println(test.twoTwo(new int%5B%5D %7B 4, 2, 2, 3 %7D));%0A%09%09System.out.println(test.twoTwo(new int%5B%5D %7B 2, 2, 4 %7D));%0A%09%09System.out.println(test.twoTwo(new int%5B%5D %7B 2, 2, 4, 2 %7D));%0A%09%7D%0A%0A%09public boolean twoTwo(int%5B%5D nums) %7B%0A%09%09for (int i = 0; i %3C nums.length; i++) %7B%0A%09%09%09if (nums%5Bi%5D == 2) %7B%0A%09%09%09%09if (i %3E 0 && nums%5Bi - 1%5D == 2)%0A%09%09%09%09%09continue;%0A%09%09%09%09if (i %3C nums.length - 1 && nums%5Bi + 1%5D == 2)%0A%09%09%09%09%09continue;%0A%09%09%09%09return false;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return true;%0A%09%7D%0A%0A%7D%0A

Add TwoTwoTest