How do I make an array method return a single object when the array length is 1?

I have a method within a class I created. Each object of the class has the property of having an an Object array, and the method returns that array. However, is there a way for me to just return the single Object from within the array when the array length is 1?