ItemStack itemStack = new ItemStack(Items.DIAMOND_SWORD); int damage = itemStack.getItemDamage(); System.out.println("This sword has " + damage + " damage.");In this example, we first create a new ItemStack object representing a diamond sword using the Items.DIAMOND_SWORD constant. We then use the getItemDamage method to get the damage value of the sword, and print out a message telling us how much damage the sword has. The package library for the ItemStack class is net.minecraft.item.