Become an adherent of the nofap school. Completely give up watching porn, do not engage in self-gratification. Do not look at girlish charms, do not fantasize on erotic topics. Let those around you think what they want. Just don't look or think about unnecessary things. Stop vulgar thoughts in a couple of seconds, switching to something else. Let your free time for self-development. TED has a presentation on the dangers of masturbation and pornography, these are really very destructive things for men. I advise you to look. Well, I answer your question "how?" You just take it and sublimate it. Watch the video with Shaya, he will explain to you. You just take and delete all bookmarks, all pr from the computer. You try not to think about sex. Hang an elastic band on your wrist, spank yourself with it every time you think about unnecessary things. Learn to control yourself and think about what you consider necessary. Do not sit around, idleness is the devil's plaything. If you are a creative person, then occupy yourself with creation. When your day is clearly scheduled for work-creativity-walk-sport-sleep, then there will simply be no time for something else.
When we are motivated by sexual desire, our imagination, courage, will, perseverance can expand to the extent that we did not even know. Sometimes the sexual energy within us is so strong that we feel an overwhelming desire to die or injure other people. And of course one can imagine that we can harness this energy and use it for other, higher purposes. For centuries, people have tried to channel this energy into higher realms. And, of course, there are famous examples of the transformation of sexual energy into creativity are Nikola Tesla, Gandhi, Richard Wagner, Dante Alighieri, Beethoven, Homer, Henry Toro and Leonardo da Vinci ..
The truth is that all people are sexual beings. The path of sexual transformation is not indulging or denying sex, but accepting sexual energy as one of the aspects of our being.
Many people are mistaken in thinking that they should get the better of their "low nature" by drowning out sexual aspects of their essence. But there is nothing good about suppressing anything in yourself, as this is a kind of delay of what will eventually return to you. Sexual energy cannot be created or destroyed, it can only be transformed.
Apart from tantric and Taoist sexual practices, there are countless other references to the latent energy of sex. Kabbalah, for example, views sexual desire as the pinnacle of spiritual expression. According to yogic philosophy, our pure sexual energy is dormant until awakening in its highest form known as Kundalini.
But I wonder why this question bothers you? You can study this area as much as you like, read literature, get involved in religion, etc., but isn't it better to use your energy for its intended purpose, and direct the remaining energy to self-development ...