Processing has a great function I use all the time:
map(value, low1, high1, low2, high2)
http://processing.org/reference/map_.html
It remaps value (that has an expected range of low1 to high1) into a target range of low2 to high2).
I want to understand the math behind it so I can use it in other languages. Anyone want to throw me a bone and help me reverse engineer it? I understand that it's a lerp that's been re-scaled and re-offset... feeling brain dead this morning.