Exact solution of the Dirac equation with a central potential