Arrays.copyOfRange(float[] original, int from, int to) has the following syntax.
public static float[] copyOfRange(float[] original, int from, int to)
In the following code shows how to use Arrays.copyOfRange(float[] original, int from, int to) method.
//w w w . j av a 2s . c o m import java.util.Arrays; public class Main { public static void main(String[] args) { float[] arr1 = new float[] {10f, 30f, 50f}; System.out.println(Arrays.toString(arr1)); // copying array arr1 to arr2 with range of index from 1 to 4 float[] arr2 = Arrays.copyOfRange(arr1, 1, 2); arr2[3] = 90f; arr2[4] = 100f; System.out.println(Arrays.toString(arr2)); } }
The code above generates the following result.