text: public BytesRef common(BytesRef output1, BytesRef output2) {assert output1 != null;assert output2 != null;int pos1 = output1.offset;int pos2 = output2.offset;int stopAt1 = pos1 + Math.min(output1.length, output2.length);while(pos1 < stopAt1) {if (output1.bytes[pos1] != output2.bytes[pos2]) {break;}pos1++;pos2++;}if (pos1 == output1.offset) {return NO_OUTPUT;} else if (pos1 == output1.offset + output1.length) {return output1;} else if (pos2 == output2.offset + output2.length) {return output2;} else {return new BytesRef(output1.bytes, output1.offset, pos1-output1.offset);}}