Earlier quoted context omitted.
The compiler will see that your operation does nothing and simply not do it.
What I mean was: do you know this to be the case for JVM 8 later? This is an interesting subject. Was there a study or a paper you can refer me to?
Assuming you mean oracles implementation, it's likely that it is.
https://www.sjoerdlangkemper.nl/2016/05/22/should-passwords-... http://www.daemonology.net/blog/2014-09-04-how-to-zero-a-buf... https://man.openbsd.org/explicit_bzero.3