Java tutorial
import java.util.Arrays; public class Main { public static void main(String[] args) { byte[] arr1 = new byte[] { 5, 15, 25 }; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 with newlength as 5 byte[] arr2 = Arrays.copyOf(arr1, 5); arr2[3] = 0; arr2[4] = 1; System.out.println(Arrays.toString(arr2)); } }