I have to question the “blueballs” theory. You say that you stopped masturbating three weeks ago. Did you stop because your testicles hurt when you tried to masturbate, or did you just stop masturbating? If you stopped because your testicles hurt, then it wouldn’t be blueballs but some other condition, like an infection to the epididymus (the tubes over and behind the testicles), or testicular torsion, where the tubes from which the testicles hang from get twisted . Even a bad cold can cause an infection to the epididymus.
If you have been abstaining from sex on purpose for the past 3 weeks, then blueballs could be the reason for the pain.
The best thing to do is to get yourself checked by a doctor.
I agree with @SmashTheState—-masturbate regularly if you can. It’s actually good for us men to masturbate on a regular basis. It boosts your immune system, increases testosterone, and allows one to produce healthy, vigorous sperm. When you abstain for long periods, sperm quality and amount are greatly reduced. Athletes often hear this myth that if you abstain from sex for a long time, it will give them greater power and increase their agility. Wrong. Abstinence has benefits, but only if the period of abstinence is not that long. If a guy abstains from sex for a moderate period of time, THEN has sex, he often sees a benefit in his testosterone levels and strength.
Btw, welcome to Fluther. :)