Java tutorial
//package com.java2s; import javax.swing.MenuElement; public class Main { public static MenuElement[] appendPath(MenuElement[] path, MenuElement newElement) { MenuElement[] newPath = new MenuElement[path.length + 1]; System.arraycopy(path, 0, newPath, 0, path.length); newPath[newPath.length - 1] = newElement; return newPath; } }