Classic Worker Task (Combinatorial Optimization) using recursion in Java