if (length > MAX_TOKEN_LENGTH) { int k; int r_offset = offset; for (k = length; k > MAX_TOKEN_LENGTH; k = k - MAX_TOKEN_LENGTH) { VTDBuffer.append(((long) ((token_type << 28) | ((depth & 0xff) << 20) | MAX_TOKEN_LENGTH) << 32) | r_offset); r_offset += MAX_TOKEN_LENGTH; }
if (length > MAX_TOKEN_LENGTH) { int k; int r_offset = offset; for (k = length; k > MAX_TOKEN_LENGTH; k = k - MAX_TOKEN_LENGTH) {
	private void writeVTD(int offset, int length, int token_type, int depth) {		//if (token_type != TOKEN_ENDING_TAG)						switch (token_type) {			case TOKEN_CHARACTER_DATA:			case TOKEN_CDATA_VAL:			case TOKEN_COMMENT:				if (length > MAX_TOKEN_LENGTH) {					int k;					int r_offset = offset;					for (k = length; k > MAX_TOKEN_LENGTH; k = k - MAX_TOKEN_LENGTH) {						VTDBuffer.append(((long) ((token_type << 28)								| ((depth & 0xff) << 20) | MAX_TOKEN_LENGTH) << 32)								| r_offset);						r_offset += MAX_TOKEN_LENGTH;					}					VTDBuffer.append(((long) ((token_type << 28)							| ((depth & 0xff) << 20) | k) << 32)							| r_offset);				} else {					VTDBuffer.append(((long) ((token_type << 28)							| ((depth & 0xff) << 20) | length) << 32)							| offset);				}				break;			default:				VTDBuffer.append(((long) ((token_type << 28)						| ((depth & 0xff) << 20) | length) << 32)						| offset);			}		// remember VTD depth start from zero		if (token_type == TOKEN_STARTING_TAG) {			switch (depth) {				case 0 :					rootIndex = VTDBuffer.size() - 1;					break;				case 1 :					if (last_depth == 1) {						l1Buffer.append(							((long) last_l1_index << 32) | 0xffffffffL);					} else if (last_depth == 2) {						l2Buffer.append(							((long) last_l2_index << 32) | 0xffffffffL);					}					last_l1_index = VTDBuffer.size() - 1;					last_depth = 1;					break;				case 2 :					if (last_depth == 1) {						l1Buffer.append(							((long) last_l1_index << 32) + l2Buffer.size());					} else if (last_depth == 2) {						l2Buffer.append(							((long) last_l2_index << 32) | 0xffffffffL);					}					last_l2_index = VTDBuffer.size() - 1;					last_depth = 2;					break;				case 3 :					l3Buffer.append(VTDBuffer.size() - 1);					if (last_depth == 2) {						l2Buffer.append(							((long) last_l2_index << 32) + l3Buffer.size() - 1);					}					last_depth = 3;					break;				default :					//rootIndex = VTDBuffer.size() - 1;			}		} else if (token_type == TOKEN_ENDING_TAG && (depth == 0)) {			if (last_depth == 1) {				l1Buffer.append(((long) last_l1_index << 32) | 0xffffffffL);			} else if (last_depth == 2) {				l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL);			}		}	}