Java tutorial
import java.util.Arrays; public class Main { public static void main(String[] args) { // initializing byte array byte arr[] = new byte[] { 1, 6, 3, 2, 9 }; System.out.println(Arrays.toString(arr)); // using fill for placing 64 from index 2 to 4 // converting int to byte Arrays.fill(arr, 2, 4, (byte) 64); System.out.println(Arrays.toString(arr)); } }