public double maxProfit(int jthObject, int currentLength, double profitJ, ArrayList<Rod> rods, double[][] table) {
		double tryToAddObject = 0;
		double dontTryToAddObject = 0;
		int currentRodLength = rods.get(jthObject).getLength();
		if(currentLength >= currentRodLength) {
			if(jthObject - 1 < 0) {
				jthObject = 2;
			}
			tryToAddObject = table[jthObject - 1][currentLength - rods.get(jthObject).getLength()] + profitJ;
		}
		if(jthObject - 1 >= 0){
			dontTryToAddObject = table[jthObject - 1][currentLength];
		}
		
		if(tryToAddObject > dontTryToAddObject) {
			return tryToAddObject;
		}
		else {
			return dontTryToAddObject;
		}
	}