Does Java syntax for iteration across arrays allocate memory?
<p>I am programming for a memory-constrained device. Hence, I want to avoid allocating any memory.</p>

<p>Obviously, iterating across sets, lists, etc will allocate an iterator and thus allocate memory. So this should be avoided.</p>

<p>Does the native java syntax for iterating across arrays allocate memory?</p>

<pre><code>Object[] array = getArray()
for(Object elem: array){
  //do something
}
</code></pre>

<p>(I suppose I could always use the old-fashioned for loop with an index variable.)</p>
