That is the right way.
Only other way would be to set $JAVA_OPTS as env variable before starting the server.
something along the lines:
export JAVA_HOME="-Xms64m -Xmx512m -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true"
but editing standalone.conf is perfectly fine and expected. as that values there are just default that should be changed to match your running environment.
Defaults are set in a way that makes sure that server starts on as many different JVM/OS-es as possible. And are not optimized for one or another os/jvm.
And, don't just comment out the whole JAVA_OPTS line as you might run into problems, just remove the -XX:MaxPermSize=256m parameter.