public static byte[] getTagAndRawVarInt64Bytes(int tag, long value)
    {
        int tagSize = computeRawVarint32Size(tag);
        int size = computeRawVarint64Size(value);
        int offset = 0;
        byte[] buffer = new byte[tagSize + size];

        if (tagSize == 1)
        {
            buffer[offset++] = (byte) tag;
        }
        else
        {
            for (int i = 0, last = tagSize - 1; i < last; i++, tag >>>= 7)
                buffer[offset++] = (byte) ((tag & 0x7F) | 0x80);

            buffer[offset++] = (byte) tag;
        }

        if (size == 1)
        {
            buffer[offset] = (byte) value;
        }
        else
        {
            for (int i = 0, last = size - 1; i < last; i++, value >>>= 7)
                buffer[offset++] = (byte) (((int) value & 0x7F) | 0x80);

            buffer[offset] = (byte) value;
        }

        return buffer;
    }
Returns a byte array encoded with the tag and var int 64
protostuff-core/src/test/java/io/protostuff/CodedOutput.java