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

Add HaveThreeTest