am I the only one that when looking at the implementation sees that there is a major flaw in the code?
if(toIndex > arrayLen) does not handle the case in which toIndex == arrayLen, which should still throw an ArrayIndexOutOfBoundsException if we are dealing with 0-based indexes.
Please correct me if I am wrong.