Ampère's law

The circulation of B round any closed loop equals mu nought times the current through it, so with enough symmetry one line integral gives the field of a long wire, inside and outside, and the uniform field mu nought n I inside a long solenoid.

From AP Physics C: Electricity and Magnetism.