initialize array in java with size code example Example: creating array java int[] intArray = new int[]{ 1,2,3,4,5,6,7,8,9,10 }