if (currentclass.equals(Object.class))
if ( (currentclass == null) || (currentclass.equals(Object.class)) )
  public static boolean hasInterface(Class intf, Class cls) {    Class[]       intfs;    int           i;    boolean       result;    Class         currentclass;        result       = false;    currentclass = cls;    do {      // check all the interfaces, this class implements      intfs = currentclass.getInterfaces();      for (i = 0; i < intfs.length; i++) {        if (intfs[i].equals(intf)) {          result = true;          break;        }      }      // get parent class      if (!result) {        currentclass = currentclass.getSuperclass();                // topmost class reached?        if (currentclass.equals(Object.class))          break;      }    }     while (!result);          return result;  }