Just use ItemContainer in the method signature. eg.
public int getOreCount(ItemContainer container, int... ids) {
return container.getAmount(ids);
}
and use it like so:
int invCoal = getOreCount(inventory, 453, 454);
int bankIron = getOreCount(bank, 440, 441);
the methods getAmount, getItems, contains etc. etc. are defined in the superclass, however if overridden in the subclass, invoking the method will still work even if your reference has the superclass as static type.
In other words, these are the same:
getInventory().getAmount(id);
((ItemContainer)getInventory()).getAmount(id);