code: public static Class[] getSuperTypes(Class from) {
          ArrayList<Class> superclasses = new ArrayList<Class>();
  
          collectInterfaces( from, superclasses );
          while ( !from.equals( Object.class ) && !from.isInterface() ) {
              superclasses.add( from.getSuperclass() );
              from = from.getSuperclass();
              collectInterfaces( from, superclasses );
          }
  
          final Class[] classes = new Class[superclasses.size()];
          superclasses.toArray(classes);
          return classes;
      }
docs: Collect all directly and indirectly related super types (classes and interfaces) of
  a given class.
  
  @param from The root class to start with
  @return A set of classes, each representing a super type of the root class