Java Reflection - Java Array.setLong(Object array, int index, long l)








Syntax

Array.setLong(Object array, int index, long l) has the following syntax.

public static void setLong(Object array,  int index,  long l)   throws IllegalArgumentException ,    ArrayIndexOutOfBoundsException

Example

In the following code shows how to use Array.setLong(Object array, int index, long l) method.

import java.lang.reflect.Array;
import java.util.Arrays;
//  w  ww  . j av  a2  s  .com
public class Main {
  public static void main (String args[]) {
    long[] array = new long[]{1L,2L,3L};
    
    Array.setLong(array, 1, 9999999999999L);
    
    System.out.println(Arrays.toString(array));


  }
}

The code above generates the following result.