I have intermittent sharp pain that sometimes hurts one or both of my testicles.

?Intermittent torsio. Intermittent torsion (it) should be ruled out. This where the testicle twists on the spermatic cord and first cuts off the venous return. It is not very common, but, you can check yourself by slowly twisting the testis in wards (like closing a book) and keep on twisting until it is painful. Pain should be identical to your complaint if it otherwise pain could be vascular congestion which is benign.
Compression. Sitting for long periods of time can cause compression of the testicles especially if pants and underwear are tight. Other causes can be development of inguinal hernias, development of a condition called hydroceles (fluid filled sac that protrudes into scrotum compressing vessles to the testicles), trauma to testicles from not wearing underwear at all, twisting of testicle inside scrotum, more...