Check out example codes for "how do you make a method that returns an array java". It will help you in understanding the concepts better.

Code Example 1

public static int[] numbers()  
{  
int[] arr={5,6,7,8,9};  //initializing array  
return arr;  
}

Learn ReactJs, React Native from akashmittal.com