Program to return an array from a method in java