copyRange
Write a method named copyRange
that takes as parameters two
arrays a1
and a2
, two starting
indexes i1
and i2
, and a length l
,
and copies the first l
elements of a1
starting at
index i1
into array a2
starting at
index i2
.
For example, if the following arrays are declared:
int[] a1 = {10, 20, 30, 40, 50, 60}; int[] a2 = {91, 92, 93, 94, 95, 96}; copyRange(a1, a2, 0, 2, 3);
After the preceding call, the contents of a2
would
be {91, 92, 10, 20, 30, 96}
. You may assume that the
parameters' values are valid, that the arrays are large enough to hold the
data, and so on.