📜  在java代码示例中编写一个简单的arraylist递归代码

📅  最后修改于: 2022-03-11 14:52:08.699000             🧑  作者: Mango

代码示例1
MyMethod3
ArrayList sum = new ArrayList();
for (i = 0; i < MyArrayList.size(); i++){
    for (j = i + 1; j < MyArrayList.size(); j++){
        for (k = j + 1; k < MyArrayList.size(); k++){
            int total = MyArrayList.get(i) + MyArrayList.get(j) + MyArrayList.get(k);
            sum.add(total);
        }
    }
}
return sum;