This is the formula for stats:
To max a pokemon's stats you must have:
-31 IVs in that stat.
-252 EVs in that stat.
-A beneficial nature. ( for defense, you would need Bold, Impish, lax, or relaxed)
-Be at level 100. (you can set DS wifi battles to do this part for you)
(Max HP requires everything here except for the nature, since there is no HP nature.)