MacOS Flutter JAVA_HOME Issue with Android Studio

If you have JAVA_HOME issue with below message on MacOS please follow my steps. You can get below messages when you run flutter command on terminal. "ERROR: JAVA_HOME is set to an invalid directory: /usr/bin/java" or "Please set the JAVA_HOME variable in your environment to match the location of your Java installation." or "ERROR: JAVA_HOME is not set and no ‘java’ command could be found in...