-really need it its important.-

Currently my code does this the first Item in the Slot

How do i make it choose the item i clicked on?
Pretending my code is this
Code:
		deleteItem(delete, getItemSlot(delete), 1);
How would i make it choose the specific slot rather then the first slot in my inventory?
Code:
	public int getItemSlot(int itemID) {
		for (int slot = 0; slot < playerItems.length; slot++) {
			if (playerItems[slot] == (itemID + 1)) {
				return slot;
			}
		}
		return -1;
	}