code: protected boolean loadedByThisOrChild(Class clazz)
      {
          boolean result = false;
          for (ClassLoader classLoader = clazz.getClassLoader();
                  null != classLoader; classLoader = classLoader.getParent()) {
              if (classLoader.equals(this)) {
                  result = true;
                  break;
              }
          }
          return result;
      }
docs: Determine whether a class was loaded by this class loader or one of
  its child class loaders.