code: public static Method searchForMethod(Class<?> type, String name, Class<?>[] parms) {
          try {
              return type.getMethod(name, parms);
          } catch (NoSuchMethodException e) {}
          Method[] methods = type.getMethods();
          for (int i = 0; i < methods.length; i++) {
              // Has to be named the same of course.
              if (!methods[i].getName().equals(name)) {
                  continue;
              }
  
              Class<?>[] types = methods[i].getParameterTypes();
              // Does it have the same number of arguments that we're looking for.
              if (types.length != parms.length) {
                  continue;
              }
  
              // Check for type compatibility
              if (areTypesCompatible(types, parms)) {
                  return methods[i];
              }
          }
          return null;
      }
docs: Searches through all methods looking for one with the specified name that
  will take the specified paramaters even if the parameter types are more
  generic in the actual method implementation. This is similar to the
  findConstructor() method and has the similar limitations that it doesn't
  do a real widening scope search and simply processes the methods in
  order.
  
  @param type param
  @param name of class
  @param parms classes
  
  @return Method object