Official vendors provide a list of hashes—typically —alongside their download links.
Ensures the file is exactly what the developers published, even if you used a mirror site for the download. Where to Find Official Java Hashes java download hash
How to verify the integrity of the downloaded file? - InControl java download hash