Magnetic nanoparticles for therapy and diagnosis are at the leading edge of the rapidly developing field of bionanotechnology. In this study, we have theoretically studied motion of magnetic nano- as well as micro-particles in the field of cylindrical Halbach array of permanent magnets. Magnetic flux density was modeled as magnetostatic problem by finite element method and particle motion was described using system of ordinary differential equations--Newton law. Computations were done for nanoparticles Nanomag-D with radius 65 nm, which are often used in magnetic drug targeting, as well as microparticles DynaBeads-M280 with radius 1.4 microm, which can be used for magnetic separation. Analyzing snapshots of trajectories of hundred magnetite particles of each size in the water as well as in the air, we have found that optimally designed magnetic circuits of permanent magnets in quadrupolar Halbach array have substantially shorter capture time than simple blocks of permanent magnets commonly used in experiments, therefore, such a Halbach array may be useful as a potential source of magnetic field for magnetic separation and targeting of magnetic nanoparticles as well as microparticles for delivery of drugs, genes, and cells in various biomedical applications.