You cannot mix Strings with primitive types to perform arithmetic operations.

The way you initialized the array in your first code snippet is correct.