A force F produces an extension e when applied to a wire of unstretched length L.
Work done on the wire during stretching = average force x extension = ½ Fe
Work done = energy stored = ½ Fe = ½ EAe2/L
If the extension is increased from e1 to e2:
Energy stored = ½ F[e2 - e1] = ½ EA[e22- e12]/L
Energy stored per unit volume of a specimen = ½ stress x strain