Java tutorial
import java.util.Arrays; public class Main { public static void main(String[] args) { // intializing an array arr1 float[] arr1 = new float[] { 10f, 20f, 25f }; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 with newlength as 5 float[] arr2 = Arrays.copyOf(arr1, 5); arr2[3] = 30f; arr2[4] = 40f; System.out.println(Arrays.toString(arr2)); } }