Arrays.copyOfRange(double[] original, int from, int to) has the following syntax.
public static double[] copyOfRange(double[] original, int from, int to)
In the following code shows how to use Arrays.copyOfRange(double[] original, int from, int to) method.
//from w ww.j av a 2s . c om import java.util.Arrays; public class Main { public static void main(String[] args) { // intializing an array arr1 double[] arr1 = new double[] {1.5, 3.5, 7.5}; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 with range of index from 1 to 4 double[] arr2 = Arrays.copyOfRange(arr1, 1, 4); System.out.println(Arrays.toString(arr2)); } }
The code above generates the following result.