public static String compactWhitespace(String instring) {
    { int count = 0;
      int length = instring.length();
      int cursor = 0;
      int newcursor = 0;
      StringBuffer result = null;

      if (length == 0) {
        return ("");
      }
      loop000 : for (;;) {
        if ((cursor > 0) &&
            (Stella.stringEqlP(Native.makeString(1, instring.charAt(cursor)), " ") &&
             Stella.stringEqlP(Native.makeString(1, instring.charAt((cursor - 1))), " "))) {
          count = count + 1;
        }
        if (cursor == (length - 1)) {
          break loop000;
        }
        cursor = cursor + 1;
      }
      result = Stella.makeRawMutableString(length - count);
      cursor = 0;
      loop001 : for (;;) {
        if (!((cursor > 0) &&
            (Stella.stringEqlP(Native.makeString(1, instring.charAt(cursor)), " ") &&
             Stella.stringEqlP(Native.makeString(1, instring.charAt((cursor - 1))), " ")))) {
          edu.isi.stella.javalib.Native.mutableString_nthSetter(result, (instring.charAt(cursor)), newcursor);
          newcursor = newcursor + 1;
        }
        if (cursor == (length - 1)) {
          break loop001;
        }
        cursor = cursor + 1;
      }
      return (result.toString());
    }
  }