method to create array