We know that the change in length of a prismatic component (here, wire is also prismatic as it has the same cross sectional area over entire length) is given by

d l=\frac{P l}{A E}

where,

P = volume of wire × unit weight =\frac{\pi d^2}{4} l w

A = area of cross section = \frac{\pi d^2}{4}

Therefore, change in length = dl = \frac{l^2 w}{E}