Optimal change with only with two euros coins and five and ten euros bills
The only way of making an odd total is with a five euro bill.  There is no point ever having more than 1 five euro bill, as you could replace pairs with a ten euro bill.  So, you should start off checking for the odd total.

if (change &gt;= 5  &amp;&amp;  change % 2 == 1) {
    c.bill5 = 1;
    change -= 5;
}


At this point, you can simply compute the number of ten euro bills, and remaining 2 euro coins.

c.bill10 = change / 10;
change = change % 10;

c.coin2 = change / 2;


The only thing you have to watch out for is a total change amount of 1 or 3 euros (or negative), which is not possible to make.  Handle those as a special case.



Your optimalChange() creates a change object, and if dealWithChangeLike31Euros() methods is called, it creates its own Change object, and the first object is abandoned.  You shouldn't create the object if it isn't going to be used.  Options include passing the change object to the dealWithChangeLike31Euros() method, or delaying the creation.

Multiple return points is sometimes a code smell.  optimalChange() has 3:


return dealWithChangeLike31Euros(change);
return null;
return c;


If you initialized Change c = null;, and only created the Change object when needed, you could have just the one return c; at the end.  Less returns may reduce the complexity.