This is a simple piece of code which takes two arrays supplied as parameters, then appends them to a new array that contains the values from the supplied arrays. Any suggestions for improvement would be greatly appreciated.
public static int[] append(int[] list1, int[] list2) {
int[] appendedList = new int[list1.length + list2.length];
for(int i = 0; i < list1.length; i++) {
appendedList[i] = list1[i];
}
for(int i = 0; i < list2.length; i++) {
appendedList[i + list1.length] = list2[i];
}
return appendedList;
}