How to set a var from java to a .env var

I and my mate are making a website and I made a .env file to add the code to our admin how do I compare that or add that to a java variable to do an if()

This might be of help:

https://docs.oracle.com/javase/tutorial/essential/environment/env.html