Ok, take the least signifigant bits of attack, defense, speed, and special. Put them together, and poof, you have the HP gene.
Or follow this game:
Start with HP gene = 0.
Is attack odd? If yes, add 8.
Is defense odd? If yes, add 4.
Is speed odd? If yes, add 2.
Is special odd? If yes, add 1.
If you didn't answer yes to any, your gene is 0. Congrats. If you answered yes to all, your gene is 15 (8+4+2+1).
"15 year old Pokémon pimps. Really now. -Annon