private void writeConstantPool(final DataOutputStream out)
			throws IOException {
		out.writeShort(constants.size());

		// Write the constants. The first constant is reserved for
		// internal use by the JVM, so start at 1.
		for (int i = 1; i < constants.size(); i++) {
			writeConstant(out, (Constant) constants.get(i));

			switch (((Constant) constants.get(i)).tag()) {
			case Constant.LONG:
			case Constant.DOUBLE:
				// Longs and doubles take up 2 constant pool entries.
				i++;
				break;
			}
		}
	}