code: public static Class<?> commonBase(Class<?> a, Class<?> b) {
          Class<?> result;
          Class<?> ifc;
  
          if (b == null) {
              throw new IllegalArgumentException();
          } else if (a == null) {
              return b;
          } else {
              result = commonSuperClass(a, b);
              if (Object.class.equals(result)) {
                  ifc = commonInterfaces(a, b);
                  if (ifc != null) {
                      result = ifc;
                  }
              }
              return result;
          }
      }
docs: Gets the common base of two classes. Common base is the most special
  class both argument are assignable to. The common base for
  different primitive types is null; the common base for a primitive
  type and a reference type is null.
  @param   a  first class, may be null
  @param   b  second class
  @return  the common base; b, if a == null;