code: public static boolean areItemStacksStackable(ItemStack stack1, ItemStack stack2)
  	{
  		return !(stack1.isEmpty() || stack2.isEmpty()) && stack1.isStackable() && stack1.getItem() == stack2.getItem()
  				&& (!stack2.getHasSubtypes() || stack2.getMetadata() == stack1.getMetadata())
  				&& ItemStack.areItemStackTagsEqual(stack2, stack1);
  
  	}
docs: Checks whether two {@link ItemStack itemStacks} can be stacked together
  
  @param stack1 first itemStack
  @param stack2 second itemStack
  @return true, if the itemStack can be stacked, false otherwise