I was using these in my code but I think they are may be not as fast as manual coded procedure. I had searched the and found some articles which say that System.arraycopy() is actually faster than copying an array manually. I am not quite sure whether that is correct or not.
Also, the function Array.sort() is the fast compared to what we write in code?
// I am merging the arrays here into a new integer array called newarray3
int[] newarray3= new int[input1.length + input2.length];
System.arraycopy(input1, 0, newarray3, 0, input1.length);
System.arraycopy(input2, 0, newarray3, input1.length, input2.length);
//sorting the array.
Arrays.sort(newarray3);
input1 and input2 are two arrays which are to be merged and then sorted. I want to know whether coding this way is making my program slower. Or could it be something else. Please help.
System.arrayCopy()is way faster and moreover it is implemented innativecode. Check this page.