result = 0; for (int i = 0 ; i < bars.length ; ++i) result += bars[i].get(); return result; } int foo(final Bar[] bars) { return foo1(0, 0, bars); } int foo1(final int n, final int result, final Bar[] bars) { if (n == bars.length) return result; return foo1(n+1, bars[n].get()+result, bars); } ループ 再帰 再代入の解消 27