Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

arraycopy merging arrays

public static int[] mergeSortedArrays(int[] myArray, int[] alicesArray) {
    int[] mergedArray = Arrays.copyOf(myArray, myArray.length + alicesArray.length);
    System.arraycopy(alicesArray, 0, mergedArray, myArray.length, alicesArray.length);
    Arrays.sort(mergedArray);
    return mergedArray;
}
Source by www.interviewcake.com #
 
PREVIOUS NEXT
Tagged: #arraycopy #merging #arrays
ADD COMMENT
Topic
Name
9+4 =