code: public static String newString(int[] codePoints, int offset, int count) {
          if (count < 0) {
              throw new IllegalArgumentException();
          }
          char[] chars = new char[count];
          int w = 0;
          for (int r = offset, e = offset + count; r < e; ++r) {
              int cp = codePoints[r];
              if (cp < 0 || cp > 0x10ffff) {
                  throw new IllegalArgumentException();
              }
              while (true) {
                  try {
                      if (cp < 0x010000) {
                          chars[w] = (char) cp;
                          w++;
                      } else {
                          chars[w] = (char) (LEAD_SURROGATE_OFFSET_ + (cp >> LEAD_SURROGATE_SHIFT_));
                          chars[w + 1] = (char) (TRAIL_SURROGATE_MIN_VALUE + (cp & TRAIL_SURROGATE_MASK_));
                          w += 2;
                      }
                      break;
                  } catch (IndexOutOfBoundsException ex) {
                      int newlen = (int) (Math.ceil((double) codePoints.length * (w + 2)
                              / (r - offset + 1)));
                      char[] temp = new char[newlen];
                      System.arraycopy(chars, 0, temp, 0, w);
                      chars = temp;
                  }
              }
          }
          return new String(chars, 0, w);
      }
docs: Cover JDK 1.5 API. Create a String from an array of codePoints.
  
  @param codePoints The code array
  @param offset The start of the text in the code point array
  @param count The number of code points
  @return a String representing the code points between offset and count
  @throws IllegalArgumentException If an invalid code point is encountered
  @throws IndexOutOfBoundsException If the offset or count are out of bounds.