My response may not be politically correct in this "enlightened" day and age, but it worked, so take it for what it you think it is worth. My son, who is now 27, was, at the age of 2 1/2, terrorizing my sister's day care group by biting other children. One day, I sat him down, and explained the problem to him. I told him that he was causing trouble for others by biting them, that it hurt them, that that was bad, and that he needed to stop doing it. I told him that I didn't think he understood how much biting hurt others, so I was going to bite him so that he understood what it felt like. I then bit his arm (did not draw blood or puncture skin). I then told him that this is what it felt like to the other children when he bit them, and that he needed to stop doing that. He cried for a few minutes, which made me feel bad, of course. I think he got the picture, however, because we didn't have trouble with him biting others after that.
Little ones - and big ones - do not always understand how their actions affect others, so sitting down and showing some of the consequences and effects can help children shape their future behavior.