There are many Java libraries that use neural networks:
tensorflow, оболочка под opencv, Google Cloud Vision API . For example, face recognition is not a problem. I have several photos in my folder and I need to sort them by similarity (for example, by faces). How can I sort them? Which library can I use? You can explain it in words.
Most likely what you are looking for is called face identification – as a rule, these are commercial technologies for face identification, which are used by all kinds of government and not only organizations. Start by listing https://facedetection.com/software/