Is the following java code sufficient for clearing the secret key in memory (setting all of its byte value to 0)?
zerorize(SecretKey key)
{
byte[] rawKey
Depending on the technology powering the garbage collector, any single object may be moved (i.e. copied) in physical memory at any time, so you cannot be sure that you will really destroy the key by zeroing an array -- assuming that you can access "the" array which holds the key, and not a copy thereof.
In shorter words: if your security model and context call for zeroing keys, then you should not use Java at all (or just about anything but C and assembly).