Java tutorial
//package com.java2s; public class Main { public static boolean isSubclassOf(Class<?> targetClass, Class<?> superClass) { if (targetClass.getSuperclass() != null) { return targetClass.getSuperclass().equals(superClass) || isSubclassOf(targetClass.getSuperclass(), superClass); } return false; } }