This only works if the dog is only playfully biting. If the dog is biting to hurt you, then you may want to seek help from a obedience school or maybe a dog trainer.
First step: if you are playing with you dog and they start to bite, first tell them no in a loud and stern voice.
Now waggle your finger in the dogs face or, if it is big problem, clap near their face.I don't like to do that to my dog because it scares him, but if biting is a big problem, its the most effective.
Next step out of the room and ignore the dog for about two minutes, and tell your family members or roommates to do the same.
Once you do this you can go back to play with them! :) but you have to do this continuously when they bite until they understand.
This is what my vet told us to do, I know it sounds kind of harsh but it does work :)
My well behaved dog peanut :)