private void resize(int newsize) {
		// create new storage
		char[] newdata = new char[newsize];

		// copy all existing elements
		for (int i = 0; i < top; i++) {
			newdata[i] = data[i];
		}

		// apply new storage
		capacity = newsize;
		data = newdata;
	}