initialization - Are direct buffers in Java initialized to a default value like arrays? -


when initialize array in java like:

float[] array = new float[1000]; 

all elements initialized 0. case when allocate direct buffer this:

floatbuffer buffer = bytebuffer.allocatedirect(4*1000).asfloatbuffer(); 

? seem zeroes, perhaps it's implementation dependent...

from ducmentation parent abstract class buffer:

the initial content of buffer is, in general, undefined.

in absence of contrary, assume applies buffers allocated bytebuffer.allocatedirect(). interestingly, suppose strictly applies ordinary array-backed buffers well, though implicit in allocation of java array array zeroed.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -