Arrays copyOfRange() method in java
// arrays copyOfRange() method in java example
import java.util.Arrays;
public class ArrayCopyOfRangeDemo
{
public static void main(String[] args)
{
int[] arrNumber = { 66, 67, 68, 69, 70, 71, 72 };
System.out.println("Given array: ");
for(int a = 0; a < arrNumber.length; a++)
{
System.out.println(arrNumber[a]);
}
int[] copyNum = Arrays.copyOfRange(arrNumber, 2, 6);
System.out.println("----------------------");
System.out.println("Between range 2 and 6: ");
for(int a : copyNum)
{
System.out.print(a + " ");
}
System.out.println();
}
}