To lengthen the hamstrings, sit on the floor with your butt touching a wall. Try to stay as close as possible to the wall with a straight back. Now, try to straighten the knees as much as possible. You can also watch this video in which the 90-degree position is done by lying on the floor with the legs against a wall for a passive stretch of the hamstrings.
Are You Chair-Shaped? Loosen the Hamstrings: http://youtube.com/watch?v=dDxBoMTHtVk.