public static List<Class<?>> sortClassesByLevelOfInheritance(Collection<Class<?>> classes) {
		List<Class<?>> result = new ArrayList<Class<?>>(classes);
		Collections.sort(result, new Comparator<Class<?>>() {
			public int compare(Class<?> c1, Class<?> c2) {
				int l1 = getLevelOfInheritance(c1);
				int l2 = getLevelOfInheritance(c2);
				
				if (l1 < l2) {
					return -1;
				}
				else if (l1 > l2) {
					return 1;
				}
				else {
					return c1.getName().compareTo(c2.getName());
				}
			}
		});
		
		return result;
	}