Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Darcy Jones   on Mar 09 In Java Category.

  
Question Answered By: Skye Hughes   on Mar 09

This is the speedy one;

static int[]
array={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
System.arraycopy(array, 0, myarray, 0, 12);

: )

And this is the Arrays.fill implementation

public static void fill(int[] a, int fromIndex, int toIndex, int val) {
rangeCheck(a.length, fromIndex, toIndex);
for (int i=fromIndex; i<toIndex; i++)
a[i] = val;
}

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on java.util.Arrays not defined? Or get search suggestion and latest updates.


Tagged: