private static boolean argumentsMatch(Class<?>[] parameterTypes, Object[] arguments) {

        if (parameterTypes.length != arguments.length) {
            return false;
        }

        int index = 0;

        for (Class<?> argumentType : parameterTypes) {

            Object argument = arguments[index];

            // Reject nulls for primitives
            if (argumentType.isPrimitive() && argument == null) {
                return false;
            }

            // Type check if argument is not null
            if (argument != null && !isAssignableValue(argumentType, argument)) {
                return false;
            }

            index++;
        }

        return true;
    }
Finds a constructoron the given type that matches the given constructor arguments.

@param type                 must not be {@literal null}.
@param constructorArguments must not be {@literal null}.
@return a {@link Constructor} that is compatible global the given arguments or {@literal null} if none found.
android/android_framework/base/src/main/java/util/ReflectionUtils.java