Here you can find the source of arraycopy(T[] src, int srcPos, T[] dest, int destPos, int length)
Parameter | Description |
---|---|
src | The source array. |
srcPos | The source starting position. |
dest | The destination array. |
destPos | The destination starting position. |
length | The amount of bytes to copy. |
private static <T> void arraycopy(T[] src, int srcPos, T[] dest, int destPos, int length)
//package com.java2s; //License from project: Open Source License public class Main { /**/*w w w . ja va2 s. c om*/ * Empirically determined point at which the average cost of a JNI call exceeds the expense * of an element-by-element copy. This number may change over time. */ private static final int JNI_COPY_ARRAY_THRESHOLD = 6; /** * Short-hand method for deciding whether or not to use the native * {@link System#arraycopy(Object, int, Object, int, int)} method or an element-by-element * copy, based on the {@link #JNI_COPY_ARRAY_THRESHOLD}. * * @param src * The source array. * @param srcPos * The source starting position. * @param dest * The destination array. * @param destPos * The destination starting position. * @param length * The amount of bytes to copy. */ private static <T> void arraycopy(T[] src, int srcPos, T[] dest, int destPos, int length) { if (length >= JNI_COPY_ARRAY_THRESHOLD) { System.arraycopy(src, srcPos, dest, destPos, length); } else { for (int i = 0; i < length; i++) { dest[destPos + i] = src[srcPos + i]; } } } }