There is a new library Spatial4J that seems to fullfill your needs, it supports various spaces and shapes
Spatial4j is a general purpose spatial / geospatial ASL licensed open-source Java library (...)
I haven't used it so far but the README
is complete, and repositery is rather popular, and it's available on maven repositery
I was looking for such spatial library when I end up both on the repo and on this question.