Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static int[] insert(int[] array, int pos, int value) {
        int[] newArray = new int[array.length + 1];
        System.arraycopy(array, 0, newArray, 0, pos);
        newArray[pos] = value;
        System.arraycopy(array, pos, newArray, pos + 1, array.length - pos);
        return newArray;
    }
}