code: private static final <T extends Appendable> void encodeRun(T buffer, short value, int length) {
          try {
              char valueChar = (char) value;
              if (length < 4) {
                  for (int j=0; j<length; ++j) {
                      if (valueChar == ESCAPE) {
                          buffer.append(ESCAPE);
                      }
                      buffer.append(valueChar);
                  }
              }
              else {
                  if (length == ESCAPE) {
                      if (valueChar == ESCAPE) {
                          buffer.append(ESCAPE);
                      }
                      buffer.append(valueChar);
                      --length;
                  }
                  buffer.append(ESCAPE);
                  buffer.append((char) length);
                  buffer.append(valueChar); // Don't need to escape this value
              }
          } catch (IOException e) {
              throw new IllegalIcuArgumentException(e);
          }
      }
docs: Encode a run, possibly a degenerate run (of < 4 values).
  @param length The length of the run; must be > 0 && <= 0xFFFF.