Question: Complete the method arrayModifier(int[] a) which takes an integer array of length n, where n > 5. The method returns an integer array of length

Complete the method arrayModifier(int[] a) which takes an integer array of length n, where n > 5. The method returns an integer array of length 10 where the first 1/2 of the array contains elements from the start of the input array and the second 1/2 of the array contains elements from the end of the input array.

Examples

input: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}

output: {0, 1, 2, 3, 4, 10, 11, 12, 13, 14}

input: {4, 5, 6, 7, 8, 9}

output: {4, 5, 6, 7, 8, 5, 6, 7, 8, 9}

Language: Java

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!