private int getSubNode(int parentIndex, char c, boolean createIfNotExists) {
    if (myAllNodesChildren[parentIndex] == null) {
      if (!createIfNotExists) {
        return 0;
      }
      char[] chars = new char[1 + LENGTH_SLOT_LENGTH];
      myAllNodesChildren[parentIndex] = chars;
    }

    char[] children = myAllNodesChildren[parentIndex];
    char childrenCount = children[children.length - LENGTH_SLOT_LENGTH];
    int left = 0;
    int right = childrenCount - 1;
    while (left <= right) {
      int middle = (left + right) >> 1;
      int index = children[middle];
      int comp = myAllNodesChars[index] - c;
      if (comp == 0) {
        return index;
      }
      if (comp < 0) {
        left = middle + 1;
      }
      else {
        right = middle - 1;
      }
    }
    if (!createIfNotExists) {
      return 0;
    }

    if (childrenCount == children.length - LENGTH_SLOT_LENGTH) {
      children = myAllNodesChildren[parentIndex] = ArrayUtil.realloc(children, (children.length * 3 / 2 + 1) + LENGTH_SLOT_LENGTH);
    }

    if (left != childrenCount) {
      System.arraycopy(children, left, children, left + 1, childrenCount - left);
    }

    int index = myAllNodesSize;
    children[left] = (char)index;
    assert childrenCount + 1 < Character.MAX_VALUE;
    children[children.length - LENGTH_SLOT_LENGTH] = (char)(childrenCount + 1);

    addNode(parentIndex, c);
    return index;
  }
private int getSubNode(int parentIndex, char c, boolean createIfNotExists)