To get a group's inheritance use this query:
AccountGroup groupA
List vals = new ArrayList();
vals.add(groupA);
Filter filter = Filter.containsAll("inheritance", vals);
QueryOptions qo = new QueryOptions();
qo.add(filter);
Iterator it = spcontext.search(AccountGroup.class, qo);
To get a list of account groups that a group inherits from use the getter on the AccountGroup:
List<AccountGroup> inheritence = groupA.getInheritance();