* @param renamed_New
   * @param old
   * @return String
   */
  public static String replaceSubstrings(String string, String renamed_New, String old) {
    { int stringlength = string.length();
      int oldlength = old.length();
      int newlength = renamed_New.length();
      int nofoccurrences = 0;
      int oldstart = 0;
      int cursor = 0;
      int resultcursor = 0;
      StringBuffer result = null;

      while ((oldstart = Native.stringSearch(string, old, cursor)) != Stella.NULL_INTEGER) {
        nofoccurrences = nofoccurrences + 1;
        cursor = oldstart + oldlength;
      }
      if (nofoccurrences == 0) {
        return (string);
      }
      result = Stella.makeRawMutableString(stringlength + (nofoccurrences * (newlength - oldlength)));
      cursor = 0;
      while ((oldstart = Native.stringSearch(string, old, cursor)) != Stella.NULL_INTEGER) {
        { int i = Stella.NULL_INTEGER;
          int iter000 = cursor;
          int upperBound000 = oldstart - 1;

          for (;iter000 <= upperBound000; iter000 = iter000 + 1) {
            i = iter000;
            edu.isi.stella.javalib.Native.mutableString_nthSetter(result, (string.charAt(i)), resultcursor);
            resultcursor = resultcursor + 1;
          }
        }
        { char renamed_Char = Stella.NULL_CHARACTER;
          String vector000 = renamed_New;
          int index000 = 0;
          int length000 = vector000.length();

          for (;index000 < length000; index000 = index000 + 1) {
            renamed_Char = vector000.charAt(index000);
            edu.isi.stella.javalib.Native.mutableString_nthSetter(result, renamed_Char, resultcursor);
            resultcursor = resultcursor + 1;
          }
        }
        cursor = oldstart + oldlength;
      }
      { int i = Stella.NULL_INTEGER;
        int iter001 = cursor;
        int upperBound001 = stringlength - 1;

        for (;iter001 <= upperBound001; iter001 = iter001 + 1) {
          i = iter001;
          edu.isi.stella.javalib.Native.mutableString_nthSetter(result, (string.charAt(i)), resultcursor);
          resultcursor = resultcursor + 1;
        }
      }
      return (result.toString());
    }
  }