java initiliaze new int array code example Example 1: set array length java int[] num = new int[5]; Example 2: java initialize int array int[] arr = new int[n];