Java Reflection - Java Array.setByte(Object array, int index, byte b)








Syntax

Array.setByte(Object array, int index, byte b) has the following syntax.

public static void 
            setByte(Object array,int index,byte b)
            throws IllegalArgumentException,
                   ArrayIndexOutOfBoundsException

Example

In the following code shows how to use Array.setByte(Object array, int index, byte b) method.

import java.lang.reflect.Array;
import java.util.Arrays;
/*w w  w  .  j  a v a2 s. c o m*/
public class Main {
  public static void main (String args[]) {
    byte[] array = new byte[]{1,2,3};
    
    Array.setByte(array, 1, (byte)9);
    
    System.out.println(Arrays.toString(array));


  }
}

The code above generates the following result.