i am trying to get an executable piece of code from this piece of pseudo code my teacher had provided in class, so that i can see step by step how it works, but due to my limited knowledge in java (less than a week), i am not able to convert this to executable codes from the given structure, please help.
below is the pseudo code: my goal is to add 6 to the 4th position in this array: arr=[1,3,5,7,8]
public class Class3 {
public static int[] insert(int[]x,int item,int position){
int[] newX= new int[x.length+1];
position =Math.min(x.length, position);
for (int i=0;i<position;i++){
newX[i]=x[i];
}
newX[position]=item;
for (int indexinOld)=position.indexinOld<x.length;indexinOld++){
newX[indexinOld+1]=x[indexinOld]
}