A method is proposed for calculating the mechanical stresses of magnetic and current systems, calculated from the energy density of a uniformly magnetized cylinder. For the calculation, an average in volume demagnetizing factor of the cylinder is introduced, which is proportional to the ratio of the cylinder diameter to its length . It is shown that the demagnetization energy , negligible for a "long" cylinder , ( ), becomes decisive in the formation of stresses at . The radial and axial stresses are investigated in a wide range of ratios.