The best way to avoid getting HIV is to not have sex. If you do have sex, you can protect yourself with these steps:
Activities like hugging, kissing, and rubbing against one another don't spread HIV as long as there are no open sores being touched. Also, you can't give yourself HIV by masturbating.
Always use a condom when having sex.
Only have sex with one person who you know is not infected.