I'm not sure if I stim really, maybe I displaced it into jerking my knee up and down if I'm sat down when I'm stressed, which is seen as fairly normal behaviour... I do fidget with my hands a lot, so I'd play with a pen twirling it between my fingers in a loop. A fidget spinner helps as well.
@George Newman provided a great coping mechanism too, which I do a lot, which is to focus elsewhere get the mind working on an imaginary task to take the mind off the stressor. I do tend to catch myself from rocking the knee as I know it can be annoying to others (because if the ground/chair is shaking when someone else is doing it, I know it stresses me out). So there's a case to be made to be aware of what you're doing and channeling that energy elsewhere. These are stress related habits that you do have some power to lessen and change, maybe start with them when you're at home, when you're alone. See if you can practice gradually lessening them / putting them into another less obvious stimulus, like a pen, stress ball, fidget spinner/fidget toy, pacing. It may feel underwhelming at first and anxiety inducing as you feel you're not expressing yourself to the full extent as you'd like, but some work does need to be put in on your behalf if you feel this is a problem. If you can try to lessen the stress too, find ways to counteract it, be it by planning ahead, rationalising the event, listening to music (which means you could mutter along with it and it's seen as "normal") and helping yourself in any way possible to avoid tricky situations.
That said,
@TheFreeCat said it well, there's nothing wrong with stimming even in public. If you feel you need to do those behaviours to calm yourself and you can't change them, then accept that they're part of you and those around you will accept it too. Honestly, most people don't really care past a certain age. Everyone is different and that's ok.