Question: If I have an object array in Java `Car[] a = {0,1,2,3,4,5,6,7}`. How would I make a copy of this array from index 2 to 7? 

I thought about making a for loop

```
Car[] b = new Car[a.length - 2];

for (int i = 2; i < a.length; i++) {
  b[i - 2] = a[i];
}

```

Is there another way by using some of Java's built in Library? If there is, would it be more or less efficient than the for loop I proposed?

Answer: 
You can use the `copyOfRange` of the `Arrays` class to copy certain ranges.

**sample:**

```
Arrays.copyOfRange(b, 2, 7);

```

Method [implementation](http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#copyOfRange%28T[],%20int,%20int%29)

```
copyOfRange(T[] original,
              int from,
              int to)

```
You can use 

```
Car[] splitArray = Arrays.copyOfRange(a, starting_index, end_index);

```