Inventory Utilities
The InventoryUtil class can be used for handling several inventory-related processes easier. For example, you can check whether an inventory contains an item stack or not.
Contains
You can check whether an inventory contains an item stack using this method:
public static boolean contains(Inventory inventory, ItemStack itemStack)
Contains at Least
You can also check whether an inventory contains at least a given amount of item stacks which are equal to a given item stack:
public static boolean containsAtLeast(Inventory inventory, ItemStack itemStack, int minimumAmount)