Dwi Putri Wahyuningsih
Compare between [Link], [Link], and [Link]
Java Nanoseconds
[Link] 18462500
[Link] 16575300
[Link] 16385700
What is faster between the three processes is the [Link]. And the slowest among the
three processes is the [Link]. Because the first [Link] is a repetition that is
done one by one, the more repetitions that occur in an array process, the longer the array process
is run.
Why is [Link] faster than [Link]?
Because of that, earlier the [Link] happened three times while the [Link]
only happened twice. Even though the copy elements in the array are the same one by one.
And lastly why are [Link] faster than [Link] or [Link]?
Because in the [Link] the method used returns a new array object containing all the
elements in the original array. Whereas in the [Link] and [Link] the method
copies the elements into another existing array. Not only that in the [Link] also does
not need to use repetitions one by one on each element. Unlike [Link] and
[Link], which repeat one by one on each element of the array.