### Question:
JavassistUtils { public static int findValidParamIndex(CtClass[] parameterTypes, CtClassFilter filter) throws NotFoundException { int indexParam = 0; for (CtClass paramClass : parameterTypes) { if (filter.isValid(paramClass)) { return indexParam; } else { indexParam++; } } return -1; } private  JavassistUtils(); static boolean isArrayOf(CtField field, CtClass typeOfArrayElements); static boolean isArrayOf(CtField field, ClassPool classPool, Class<?> superClass); static boolean isBooleanArray(CtField field); static boolean isByteArray(CtField field); static boolean isCharArray(CtField field); static boolean isDoubleArray(CtField field); static boolean isFloatArray(CtField field); static boolean isIntArray(CtField field); static boolean isLongArray(CtField field); static boolean isShortArray(CtField field); static boolean isCharSequenceArray(CtField field, ClassPool classPool); static boolean isStringArray(CtField field, ClassPool classPool); static boolean isArrayList(CtField field, ClassPool classPool); static boolean isParcelableArray(CtField field, ClassPool classPool); static boolean isSerializableArray(CtField field, ClassPool classPool); static boolean isActivity(CtClass clazz); static boolean isService(CtClass clazz); static boolean isContext(CtClass clazz); static boolean isBroadCastReceiver(CtClass clazz); static boolean isContentProvider(CtClass clazz); static boolean isApplication(CtClass clazz); static boolean isFragment(CtClass clazz); static boolean isSupportFragment(CtClass clazz); static boolean isView(CtClass clazz); static boolean isSubType(ClassPool classPool, CtClass clazz, Class<?> superClass); static boolean isSubClass(ClassPool classPool, CtClass clazz, Class<?> superClass); static boolean isSubClass(ClassPool classPool, CtClass clazz, String superClassName); static List<CtField> getAllInjectedFieldsForAnnotation(CtClass clazz,
      Class<? extends Annotation> annotationClazz); static List<CtConstructor> extractValidConstructors(final CtClass classToTransform,
      CtClassFilter filter); static int findValidParamIndex(CtClass[] parameterTypes, CtClassFilter filter);  }### Answer:
@Test public void testFindValidParamIndex() throws Exception { CtClass class1 = ClassPool.getDefault().get(Foo.class.getName()); CtClass class2 = ClassPool.getDefault().get(Bar.class.getName()); CtClass class3 = ClassPool.getDefault().get(TestClass.class.getName()); CtClass[] params = new CtClass[] { class1, class2, class3 }; int index1 = JavassistUtils.findValidParamIndex(params, new FalseCtClassFilter()); int index2 = JavassistUtils.findValidParamIndex(params, new SingleCtClassFilter(Foo.class)); int index3 = JavassistUtils.findValidParamIndex(params, new SingleCtClassFilter(Bar.class)); assertThat(index1, is(-1)); assertThat(index2, is(0)); assertThat(index3, is(1)); }