text: public static BytesRef toBytesRef(IntsRef input, BytesRefBuilder scratch) {scratch.grow(input.length);for(int i=0;i<input.length;i++) {int value = input.ints[i+input.offset];assert value >= Byte.MIN_VALUE && value <= 255: "value " + value + " doesn't fit into byte";scratch.setByteAt(i, (byte) value);}scratch.setLength(input.length);return scratch.get();}