Masturbation is what people do when they either have a lot of free time or just want to feel good or relieve stress.
If you're trying to stop because it has become an unhealthy addiction then you must distract yourself by doing something else you like. Something that keeps you away from masturbating.
I used to tell people that even if you fail, it's alright, but if you honestly cannot keep your hand off your junk, you need help.