Is that how languages that always give you zeroed arrays (e.g., java) do it?
But anything is possible. Maybe some big customer used this pattern and now Java detects it and does something fancy like what I suggested. But really, this is an unusual scenario for an application.
Efficient zeroing is something JVMs put some thought into. Well, with a notable exception, in HotSpot itself: We were able to substantially improve its performance by using memset() to perform the zeroing.
[0] (PDF) http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.225...