How to intialize the arrayList when creating a new method : I am creating a program to find the sum of any two array element equal to the given value i required. When checking for appropriate patches 
ex.,

     if (a[0] == givenValue){
                arrayList = new ArrayList<>();
                arrayList.add(a[0]);
                return arrayList;
            }
            else if (a[n] == givenValue){
                arrayList = new ArrayList<>();
                arrayList.add(a[0]);
                return arrayList;
            }

I have keep initialize the array every time I am doing it and adding it manually. I have try to create a method

     public static ArrayList<Integer> sum(ArrayList<Integer> arr,int[] a,int i){
            arr = new ArrayList<>();
            arr.add(a[i]);
            return arr;
        }
but when I declare it in the if else statement it says the ArrayList variable is not initialized which is correct. Is there any way I could initialize it in the method only so that I might not have to initialize it over and over again.