Zero-energy states of massive Dirac equation in magnetic fields