This can be more tricky than described because the type variable may also be coming from anywhere in the hierarchy, and the variable index can easily change at each level. E.g.:
interface Container<E, T> {
}
//Notice how E, T became T, E, so indices can not be trusted
interface SubContainer<E, T> extends Container<T, E> {
}
This means you'd need to walk the hierarchy and collect variables at each level.
I suggest you use GeAnTyRef for similar scenarios as it already takes care of complexities (and might already have a way to do what you're after without doing the variable resolution yourself):
Type resolved = new TypeToken<Container<Integer>>(){}.getType(); //or get the instance in any way you already do
TypeVariable variable = Container.class.getTypeParameters()[0];
GenericTypeReflector.getTypeParameter(resolved, variable); //Gets you Integer
Disclosure: I am the maintainer of GeAnTyRef lib