public class Example { public static void main(String[] args) { int[] numbers = {1,2,3}; // copy a new array int[] newNumbers = new int[numbers.length+1]; for(int i=0; i<numbers.length;i++){ newNumbers[i] = numbers[i]; } newNumbers[numbers.length]=4; } }