Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.lang.reflect.Method;

public class Main {
    private static Method findNeededMethod(String methodName, Class<?>[] cs, Method[] methods) {

        if (methodName == null || "".equals(methodName.trim()) || methods == null || methods.length == 0)
            return null;

        out: for (Method m : methods) {
            Class<?>[] clzs = m.getParameterTypes();

            if (cs.length != clzs.length)
                continue;

            for (int i = 0; i < cs.length; i++)
                if (cs[i] != clzs[i])
                    continue out;

            if (methodName.equals(m.getName()))
                return m;
        }
        return null;
    }
}