I need to write a method(Which i'm calling "expand") that takes an int array as one of its parameters and returns a new int array that is 5 elements longer. The contents of the original array need to be copied into the last elements of the new array. The first 5 elements of the new array need to be set to the value of the second parameter to expand.
So...
int[] a = new int[]{1,2,3,4,5};
int[] a2 = expand(a,-1);
should have the same result as...
int[] a2 = new int[]{-1.-1,-1,-1,-1,1,2,3,4,5};
I currently have:
Expand|Select|Wrap|Line Numbers
- public void expand(int a[])
- {
- }