import java.util.ArrayList;
public class Solution {
    public ArrayList<Integer> FindNumbersWithSum(int [] array,int sum) {
        ArrayList<Integer> result=new ArrayList<Integer>();
        //边界条件
        if(array==null||array.length<=1){
            return result;
        }
        int flag=0;
        ArrayList<ArrayList<Integer>> list = new ArrayList<>();
        for(int i=0;i<array.length;i++){
            for(int j=array.length-1;j>i;j--){
                if(array[i]+array[j]==sum){
                    flag++;
                    ArrayList<Integer> mlist = new ArrayList<>();
                    mlist.add(array[i]);
                    mlist.add(array[j]);
                    list.add(mlist);
                }
            }
        }
       if(flag!=0) return list.get(0);
        else return result;
    }
}