Fill Elements in an int type Array in Java
Description
The following code shows how to fill Elements in an int type Array.
Example
/*ww w. j a va2s .c om*/
import java.util.Arrays;
public class Main {
public static void main(String[] argv) throws Exception {
int[] intArr = new int[10];
int intFillValue = -1;
Arrays.fill(intArr, intFillValue);
System.out.println(Arrays.toString(intArr));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »