title: Java - Dice roll combinations that amount to the same target value
body: <p>The problem I'm having is with calculating from a set number of dice, and a set target value, what the best possible combination of dice is so that the most target value can be reached as many times as possible, without re-using a single dice. </p>
  
  <p><strong>To clarify, here is an example:</strong>
  6 dice are used, holding the values: 1, 1, 1, 2, 4, 4 and the target that I want to reach is 5.</p>
  
  <p>To get 5, I can combine the dice in different ways, for example 1+1+1+2 is five, as well as 4+1. But what I want is to be able to uniquely combine as many of the dice as possible to reach my target value as many times as I can. The combination I would have to go for in that case is: 4+1 and another 4+1, reaching my target value twice.</p>
  
  <p>Doing this programmatically proved difficult though, any suggestions are greatly appreciated.</p>