import java.lang.reflect.Array;
public class MainClass {
public static void main (String args[]) {
int[] array = (int[])Array.newInstance(int.class, 3);
for(int i=0;i<array.length;i++){
array[i] = i;
}
int length = Array.getLength(array);
for (int i=0; i<length; i++) {
int value = Array.getInt(array, i);
System.out.println("Position: " + i + ", value: " + value);
}
}
}
Position: 0, value: 0
Position: 1, value: 1
Position: 2, value: 2