Elastic energy is the potential mechanical energy stored in the configuration of a material.
Spring Potential Energy: U = 1/2 kx2
where, x = Spring Stretch Length, k = Spring Force Constant, U = Spring Potential Energy.
For example, when Spring Force Constant(k) = 2N/m, Spring Stretch Length(x) = 0.1m, Spring Potential Energy(U) = 0.01J.