If you are swimming and get a cramp remain calm, keep moving your other limbs to stay afloat. If you are near shallow water try to stand up and stretch, if not raise one arm to seek help.
When you're back safely onshore make sure you drink lots of water.