public long getMaxArea(int[] histogram) {
		long maxArea = 0;
		if (histogram == null || histogram.length == 0)
			return maxArea;

		Stack<Item> stk = new Stack<Item>();
		stk.push(new Item(Integer.MIN_VALUE, -1));
		for (int i = 0; i <= histogram.length; i++) {
			Item cur = new Item((i < histogram.length ? histogram[i]
					: Integer.MIN_VALUE), i);
			if (cur.height > stk.peek().height) {
				stk.push(cur);
				continue;
			}

			while (stk.size() > 1) {
				Item prev = stk.peek();
				long area = (i - prev.pos) * prev.height;
				if (area > maxArea) {
					maxArea = area;
				}
				prev.height = cur.height;
				if (prev.height > stk.get(stk.size() - 2).height) {
					break;
				}
				stk.pop();
			}
		}
		return maxArea;
	}