Is there a way to do the following at the same time?
static final int UN = 0; // uninitialized nodes int[] arr; // ... code ... arr = new int[size]; for (int i
Oops, read your question better:
You can init an array like so
int[] arr = new int[] {UN, UN, UN, UN, UN};
But ofcourse, if you don't know the size at compile time, then you have to do the for loop. The second technique is not possible.