Either catch multiple in the Pokemon Village and check them with the IV guy or be lucky and find ditto in the safari zone (guaranteed with two 31 IV).
If you're referring to how I bred Larvitar/Gastly with 31 Atk/Sp.Atk IV, the answer is I caught multiple ones, had them checked with the IV guy and bred ones with relatively superior potential or outstanding potential overall and used power items to pass the 31 IV down.