optimize Array.getSequence()