Java Reflection Java Java API
java.lang.reflect.Array
public static void setLong(Object array, int index, long l) throws IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified long value.
long
package com.logicbig.example.array;import java.lang.reflect.Array;import java.util.Arrays;public class SetLongExample { public static void main(String... args) { Object o = Array.newInstance(long.class, 3); for (int i = 0; i < 3; i++) { Array.setLong(o, i, i * 55); } System.out.println(Arrays.toString((long[]) o)); }}
[0, 55, 110]