A general method for calculating the self-induced magnetic force of an axisymmetric toroidal current