private static void getAllInterfaces(Class<?> cls, HashSet<Class<?>> interfacesFound) {
        while (cls != null) {
            Class<?>[] interfaces = cls.getInterfaces();

            for (Class<?> i : interfaces) {
                if (interfacesFound.add(i)) {
                    getAllInterfaces(i, interfacesFound);
                }
            }

            cls = cls.getSuperclass();
         }
     }
Get the interfaces for the specified class.

@param cls  the class to look up, may be {@code null}
@param interfacesFound the {@code Set} of interfaces for the class
android/android_framework/base/src/main/java/lang3/ClassUtils.java