Java tutorial
import java.util.Arrays; public class Main { public static void main(String[] args) { // intializing an array arr1 double[] arr1 = new double[] { 1.5, 2.5, 3.5 }; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 with newlength as 5 double[] arr2 = Arrays.copyOf(arr1, 5); arr2[3] = 0.44; arr2[4] = 0.55; System.out.println(Arrays.toString(arr2)); } }