public class MatchBag02 {
public static void main(String[] args) {
BagQuestion bq = new BagQuestion();
int [] items = {11,8,7,6,5};
int target = 20;
bq.getResult(items,0,target);
}
}
class BagQuestion {
private ArrayList<Integer> arr = new ArrayList<Integer>();
public void getResult(int [] items,int low, int target) {
if (matchBag(items,low,target) == false) {
System.out.println("没有合适的组合");
}else {
System.out.println("答案为:");
for (int i=0;i <arr.size() ;i ++ ) {
System.out.print( arr.get(i) + ",");
}
}