static Int maxNumberOfMethodArguments(O o, S method) { Class c; bool mustBeStatic = false; if (o instanceof Class) { c = (Class) o; mustBeStatic = true; } else c = o.getClass(); Class _c = c; int n = -1; while (c != null) { for (Method m : c.getDeclaredMethods()) { if (!m.getName().equals(method)) continue; if (mustBeStatic && !methodIsStatic(m)) continue; n = max(n, l(m.getParameterTypes())); } c = c.getSuperclass(); } ret n < 0 ? null : n; }