Mega Code Archive

 
Categories / Java / Collections Data Structure
 

Fill to a contiguous range of elements in an array

import java.util.Arrays; public class Main {   public static void main(String[] argv) throws Exception {     int startIndex = 0;     int endIndex = 4;     String[] stringArr = new String[10];     String stringFillValue = "1";     Arrays.fill(stringArr, startIndex, endIndex, stringFillValue);   } }