Energy spectrum of a 2D Dirac electron in the presence of a constant magnetic field