Get help from a professional,That's the best way. You can try to do other things when you feel you may hurt yourself to keep your mind off of whatever is causing you to do this,like running, working out, writing go outside, paint, ride a bike, bake a cake, go for a walk with your ipod, sit by the lake, draw what you see in the park.