Solving the Bloch equations is a core procedure in the optimal design of radio frequency pulses, which has direct impacts on the quality of acquired images in magnetic resonance imaging. Although the analytical solutions of the Bloch equations exist under some circumstances, they hardly can be applied for practical use because of their complexity and lack of generality. In this paper, we employ precise time integration to solve the Bloch equations. Based on a high precision algorithm and in conjunction with a global optimization algorithm, we provide a complate procedure for the design of radio frequency pulses. The numerical data listed at the end of this paper demonstrate that the pulses derived from our algorithm have good frequency selectivity.