public class Insert { public static void main(String[] args) { ConsoleReader console = new ConsoleReader(System.in); String[] staff = new String[6]; staff[0] = "Dick"; staff[1] = "Harry"; staff[2] = "Juliet"; staff[3] = "Romeo"; staff[4] = "Tom"; int staffSize = staff.length - 1; print(staff, staffSize); System.out.print ("Insert before which element? (0 - 4) "); int pos = console.readInt(); // shift all element after pos up by one for (int i = staffSize; i > pos; i--) staff[i] = staff[i - 1]; // insert new element into freed slot staff[pos] = "New, Nina"; staffSize++; print(staff, staffSize); } /** Prints an array of strings @param s the string array @param sSize the number of strings in the array */ public static void print(String[] s, int sSize) { for (int i = 0; i < sSize; i++) System.out.println(i + ": " + s[i]); } } //