/** * Inserts one array into another at the given position. Existing elements are * shifted to the right. For example, if arr is [10, 20, 30, 40, 50, 60], pos is * 1, and toInsert is the array [101, 102, 103], then after calling this method, * arr contains [10, 101, 102, 103, 20, 30]. If pos plus the length of toInsert * exceeds the length of arr, the extra elements of toInsert are ignored. If pos * is out of range, the method does nothing. * * @param arr given array to be modified * @param pos starting insert position * @param toInsert elements to be inserted */ public static void insertArray(int[] arr, int pos, int[] toInsert) {