How does one get a rock hard errection?

Depends. The penis is a pump, blood flows in, the veins control preventing the blood out (with sexual arousal) which makes the penis hard. If your heart is healthy enough for circulation, your medications/or alcohol do not interfere with maintaining an erection, and your sexual choices are good, the " rock hardness" should be there for you. Poor sleep, depression or obesity can interfere.
Check it out. If you are having problems , realize that even young men can have a testosterone issue. Blood sugar, kidneys, high blood pressure or thyroid can come into play also.