Indeed, Arrays.fill all the way.
On a vaguely related note.
back when I was doing J2ME work, 1 of the fastest ways to fill an array was something like this :-
public static void fill(int [] array, int value)
{
int length = Math.min(array.length,16);
for(int i=0; i< length;i++)
{
array[i] = value;
}
while(length<<1 < array.length)
{
System.arraycopy(array,0,array,length,length);
length<<=1;
}
System.arraycopy(array,0,array,length,array.length-length);
}
Crazy realy
infact, on 1 phone in particular, due to a bug in arraycopy,
(it never made a copy of the src array when src=dst) the fastest way to fill an array was :-
public static void fill(int [] array, int value)
{
array[0] = value;
System.arraycopy(array,0,array,1,array.length-1);
}
None of this is useful, but its interesting none-the-less