public List<Integer> calculate(int[] moneys, int billAmount) {
    validateInputData(moneys, billAmount);

    List<Integer> change = new LinkedList<Integer>();
    while (billAmount > 0 && moneys.length > 0) {
      for (int i = moneys.length - 1; i >= 0; i--) {
        if (billAmount - moneys[i] >= 0) {
          change.add(moneys[i]);
          billAmount -= moneys[i];
          break;
        }
      }
    }
    return change;
  }
Iterative solution to this algorithm. This algorithm has a complexity order equals to O(N)
where N is the billAmount/maxMoneyValue. At the end, linear to the value passed as parameter.
src/main/java/com/github/pedrovgs/problem47/ReturnChange.java