Fermion energies in the background of a cosmic string