private static int getJobMaxNeed(ArrayList<Pair> list, ReservedRequest job) {

		int s = 0;
		for (int i = 0; i < list.size(); i++) {
			Pair pair = list.get(i);
			if (pair.time >= job.getInitialTime()) {
				if (pair.time == job.getInitialTime())
					s = i;
				else
					s = i - 1;
				break;
			}
		}

		//
		int k = 0;
		Iterator<Pair> itr = list.iterator();
		while (itr.hasNext() && k < s) {
			itr.next();
			itr.remove();
			k++;
		}

		int max = 0;
		for (int i = 0; i < list.size(); i++) {
			Pair pair = list.get(i);
			//if the job end time is greater than this reserved instance contract life
			//then get the
			if (pair.time < job.getEndTime()) { 
				int need = job.getNumberInstance() - pair.available;
				if (need > max)
					max = need;
			} else {
				break;
			}
		}

		return max;
	}