static TreeSet numbersOfMethodArguments(O o, S method) { Class c; bool mustBeStatic; if (o instanceof Class) { c = (Class) o; mustBeStatic = true; } else c = o.getClass(); new TreeSet numbers; while (c != null) { for (Method m : c.getDeclaredMethods()) { if (!m.getName().equals(method)) continue; int n = l(m.getParameterTypes()); numbers.add(nn); } c = c.getSuperclass(); } ret numbers; }