Fill Elements in a byte Array in Java
Description
The following code shows how to fill Elements in a byte Array.
Example
//w w w .j a v a 2 s . c o m
import java.util.Arrays;
public class Main {
public static void main(String[] argv) throws Exception {
byte[] byteArr = new byte[10];
byte byteFillValue = (byte) 0xFF;
Arrays.fill(byteArr, byteFillValue);
System.out.println(Arrays.toString(byteArr));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »