Arrays.fill(byte[] a, byte val) has the following syntax.
public static void fill(byte[] a, byte val)
In the following code shows how to use Arrays.fill(byte[] a, byte val) method.
/*from w w w.j av a 2 s . c o m*/ import java.util.Arrays; public class Main { public static void main(String[] args) { // initializing byte array byte arr[] = new byte[] {1, 6, 3}; System.out.println(Arrays.toString(arr)); // using fill for placing 8 // converting int to byte Arrays.fill(arr,(byte)8); System.out.println(Arrays.toString(arr)); } }
The code above generates the following result.