You can set a property as an Array the same way as other properties using the JCR API. You invoke the Node object;s setProperty method.
Consider the following code:
Node node = session.getNode("/content/dam/reports");
javax.jcr.ValueFactory valueFactory = session.getValueFactory();
Node nodereport = session.getNode("/content/reports");
String[] colors ={"Red","Black","Orange","Blue"};
nodereport.setProperty("colors",colors);
When you run this code - you add a new property named colors to the /content/reports node -- as shown here:
[img]report.png[/img]
If you want to set a single value of the array -- you can do that too:
nodereport.setProperty("colorssingle",colors[0]);
In this case -- singlecolor is assigned Red - and the data type of colorssingle is String -- not String[].