public static void main (String[] args) {

        //Data sanitization
        if (args.length < 3 || args.length % 2 == 0) {
            throw new IllegalArgumentException();
        }

		int capacity = Integer.parseInt(args[args.length - 1]);
         
        items = new Item[1 + (args.length - 1) / 2];
    
        int j = 1;
		for (int i = 0; i < args.length - 1; i += 2) {
            items[j] = new Item(Integer.parseInt(args[i]), Integer.parseInt(args[i + 1]));
            j++;
		}
        // 2D array of Knapsacks
        table = new Knapsack[items.length][capacity + 1];

        // Fill first row and column with empty Knapsacks
        for (int i = 0; i < items.length; i++) {
            table[i][0] = new Knapsack();
        }

        for (int i = 0; i < capacity + 1; i++) {
            table[0][i] = new Knapsack();
        }
        
        Knapsack result = tableSolver(items.length - 1, capacity);

        // print out result in a pretty way
        String stringedResult = "";
        for (int i = 0; i < result.getInventory().size(); i++) {
            stringedResult += "Take the " + result.getInventory().get(i).getWeight() + " pound item: $" + result.getInventory().get(i).getPrice() + " \n";
        }
        stringedResult += "********************\n" + "Totals: " + result.getWeightTotal() + " pounds, $" + result.getPriceTotal();

        System.out.println(stringedResult);
	}