Leg shaking, especially as it relates to hormonally charged males, is a warning sign of imminent gastric profusion. I recommend that upon noting this sign, you clear the area immediately! Or, simply light a match.
If he was just sitting next to you while studying don't assume that he was doing it because he was nervous. Chances are he wasn't, he was simply doing it out of habit. I do it when in my room studying by myself. It's something to do, I can't just sit there and concentrate unless I'm distracting myself (if that makes sense). In fact I'm doing it right now. You may be hot, but I'm not entirely sure your that hot :P
It might be nervousness, but I bounce my leg up and down a lot of the time with out noticing. Just fidgeting. But if you notice a guy doing this only when he's sitting near you, I'd say he was probably feeling nervous - which is a good thing, because that probably means he likes you.