Java examples for Collection Framework:Array Element
replace value in Array
//package com.java2s; import java.util.Arrays; public class Main { public static void main(String[] argv) throws Exception { int[] arr = new int[] { 34, 35, 36, 37, 37, 37, 67, 68, 69 }; int startIndex = 2; int endIndex = 2; int value = 2; System.out.println(java.util.Arrays.toString(replaceArray(arr, startIndex, endIndex, value))); }//from w w w.jav a2 s . co m public static int[] replaceArray(int[] arr, int startIndex, int endIndex, int value) { Arrays.fill(arr, startIndex, endIndex, value); return arr; } }