Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. Creating a 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.
  2. I'm not 100% sure how to start any help would be great !
  3.  
  4. My test case:
  5.  
  6.    int[] a = {4, 5, 6, 7, 8, 9};
  7.    System.out.println(Arrays.toString(arrayModifier(a)))
  8.  
  9. output:
  10.  
  11.    [4, 5, 6, 7, 8, 5, 6, 7, 8, 9]
  12.  
  13. Another test case:
  14.  
  15.    int[] a = {23, 43, 23, 56, 78, 95, 67, 24, 15, 28, 37, 48, 66};
  16.    System.out.println(Arrays.toString(arrayModifier(a)))
  17.  
  18. output:
  19.  
  20.    [23, 43, 23, 56, 78, 15, 28, 37, 48, 66]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement