// Ways to build and return array of Strings

// Returning an array of Strings from a method
// When you know all the strings at once.
return new String[]{ "one", "two"};

// Returning an array of Strings from a method
// when you know in advance how many there will be.
String[] things = new String[2];
things[0] = "one";
things[1] = "two";
return things;

// Returning an array of Strings from a method
// when you don't know in advance how many there will be.
Arraylist<String> al = new ArrayList<String>( max );
al.add( "one" );
al.add( "two" );

// ...

// converting the temporary ArrayList to a tidy array.
// No (String[]) cast needed with generics.
return al.toArray( new String[ al.size() ] );