code: public static Method findMethod(Class<?> clazz, String methodName) throws NoSuchMethodException
    {
      for(Method method : clazz.getDeclaredMethods()) {
        if(method.getName().equals(methodName)) {
          method.setAccessible(true);
          return method;
        }
      }
  
      Class<?> superclass = clazz.getSuperclass();
      if(superclass != null) {
        if(superclass.getPackage().equals(clazz.getPackage())) {
          return findMethod(superclass, methodName);
        }
      }
  
      throw new NoSuchMethodException(String.format("%s#%s", clazz.getName(), methodName));
    }
docs: Find method with given name and unknown parameter types. Traverses all declared methods from given class and
  returns the one with specified name; if none found throws {@link NoSuchMethodException}. If there are overloaded
  methods returns one of them but there is no guarantee which one. Returned method has accessibility enabled.
  <p>
  Implementation note: this method is inherently costly since at worst case needs to traverse all class methods. It
  is recommended to be used with external method cache.
  
  @param clazz Java class to return method from,
  @param methodName method name.
  @return class reflective method.
  @throws NoSuchMethodException if there is no method with requested name.