We would like to know how to fill Elements in an Array.
import java.util.Arrays; // w ww.ja v a 2s.c o m public class Main { public static void main(String[] argv) throws Exception { boolean[] booleanArr = new boolean[10]; boolean booleanFillValue = false; Arrays.fill(booleanArr, booleanFillValue); } }
Fill to a continuous range of elements in an array
import java.util.Arrays; // w ww. j a va 2s . c o m public class Main { public static void main(String[] argv) throws Exception { int startIndex = 0; int endIndex = 4; boolean[] booleanArr = new boolean[10]; boolean booleanFillValue = true; Arrays.fill(booleanArr, startIndex, endIndex, booleanFillValue); } }