Devolver una matriz de un método

public class ReturnMethod {
    static int[] ReturnArrayFromMethod() {
        // declaring array and initialized
        // variable arrayRefVar.
        int[] result = { 1, 2, 3, 4, 5 };
        return result;
    }

    public static void main(String[] args) {
        // Returning an Array from a Method
        int[] A = ReturnArrayFromMethod();
        for (int i = 0; i < A.length; i++) {
            System.out.println(A[i]);
        }
    }
}
Rajput