Answer:
If the cramps are happening from sitting at a desk all day, then get up and stretch for five minutes every hour - and get a glass of water. If the cramps are happening at night and the water and diet changes are not doing the trick, sometimes adding an ankle splint that keeps the toes pointing toward the ceiling can be helpful.
If that doesn't work, see your doctor. Statin drugs for high cholesterol are a common culprit of muscle cramps and there are many other uncommon causes that your physician might explore with routine blood testing and a good physical examination.