@SuppressWarnings("unchecked")
	private Item[] resize(int newCapacity) {
		if (newCapacity > N)
			System.out.println("Increasing capacity from " + N + " to " + newCapacity);
		else
			System.out.println("Decreasing capacity from " + N + " to " + newCapacity);
		Item[] t = (Item[]) new Object[newCapacity + 1];
		for (int i = 0, j = front; j != rear; i++, j = (j + 1) % (N + 1))
			t[i] = q[j];

		N = newCapacity;
		
		// size() makes use of front and rear. So set rear = size() before resetting front
		rear = size();
		front = 0;

		System.out.println("Resize " + " -> front: " + front + " rear: " + rear);
		return t;
	}