@Override
	public String debugInfo() {
		final StringBuilder s = new StringBuilder("INTERNAL REPRESENTATION:\n");
		final Formatter f = new Formatter(s, Locale.ENGLISH);

		if (isEmpty())
			return s.append("null\n").toString();
		
		f.format("Elements: %s\n", toString());
		
		// elements
		int firstBitInWord = 0;
		for (int i = 0; i <= lastWordIndex; i++) {
			// raw representation of words[i]
			f.format("words[%d] = ", i);
			String ws = toBinaryString(words[i]);
			if (isLiteral(words[i])) {
				s.append(ws.substring(0, 1));
				s.append("--");
				s.append(ws.substring(1));
			} else {
				s.append(ws.substring(0, 2));
				s.append('-');
				if (simulateWAH)
					s.append("xxxxx");
				else
					s.append(ws.substring(2, 7));
				s.append('-');
				s.append(ws.substring(7));
			}
			s.append(" --> ");

			// decode words[i]
			if (isLiteral(words[i])) {
				// literal
				s.append("literal: ");
				s.append(toBinaryString(words[i]).substring(1));
				f.format(" ---> [from %d to %d] ", firstBitInWord, firstBitInWord + MAX_LITERAL_LENGHT - 1);
				firstBitInWord += MAX_LITERAL_LENGHT;
			} else {
				// sequence
				if (isOneSequence(words[i])) {
					s.append('1');
				} else {
					s.append('0');
				}
				s.append(" block: ");
				s.append(toBinaryString(getLiteralBits(getLiteral(words[i]))).substring(1));
				if (!simulateWAH) {
					s.append(" (bit=");
					int bit = (words[i] & 0x3E000000) >>> 25;
					if (bit == 0) 
						s.append("none");
					else 
						s.append(String.format("%4d", bit - 1));
					s.append(')');
				}
				int count = getSequenceCount(words[i]);
				f.format(" followed by %d blocks (%d bits)", 
						getSequenceCount(words[i]),
						maxLiteralLengthMultiplication(count));
				f.format(" ---> [from %d to %d] ", firstBitInWord, firstBitInWord + (count + 1) * MAX_LITERAL_LENGHT - 1);
				firstBitInWord += (count + 1) * MAX_LITERAL_LENGHT;
			}
			s.append('\n');
		}
		
		// object attributes
		f.format("simulateWAH: %b\n", simulateWAH);
		f.format("last: %d\n", last);
		f.format("size: %s\n", (size == -1 ? "invalid" : Integer.toString(size)));
		f.format("words.length: %d\n", words.length);
		f.format("lastWordIndex: %d\n", lastWordIndex);

		// compression
		f.format("bitmap compression: %.2f%%\n", 100D * bitmapCompressionRatio());
		f.format("collection compression: %.2f%%\n", 100D * collectionCompressionRatio());

		return s.toString();
	}