Java examples for Collection Framework:Array Auto Increment
add Item To array
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String object = "java2s.com"; String[] array = new String[] { "1", "abc", "level", null, "java2s.com", "asdf 123" }; System.out.println(java.util.Arrays.toString(addToList(object, array)));// w w w .j a v a 2s . com } public static String[] addToList(String object, String[] array) { String[] ret = new String[array.length + 1]; for (int i = 0; i < array.length; i++) { ret[i] = array[i]; } ret[array.length] = object; return ret; } }