private org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[] convertBundleInfos(
     BundleInfo[] configuration, URI installArea) {
   // convert to SimpleConfigurator BundleInfo Type
   org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[] simpleInfos =
       new org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[configuration.length];
   for (int i = 0; i < configuration.length; i++) {
     BundleInfo bundleInfo = configuration[i];
     URI location = bundleInfo.getLocation();
     if (bundleInfo.getSymbolicName() == null
         || bundleInfo.getVersion() == null
         || location == null)
       throw new IllegalArgumentException(
           "Cannot persist bundleinfo: " + bundleInfo.toString()); // $NON-NLS-1$
     // only need to make a new BundleInfo if we are changing it.
     if (installArea != null) location = URIUtil.makeRelative(location, installArea);
     simpleInfos[i] =
         new org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo(
             bundleInfo.getSymbolicName(),
             bundleInfo.getVersion(),
             location,
             bundleInfo.getStartLevel(),
             bundleInfo.isMarkedAsStarted());
     simpleInfos[i].setBaseLocation(bundleInfo.getBaseLocation());
   }
   return simpleInfos;
 }
  private void algorithm(
      int initialSl,
      SortedMap bslToList,
      BundleInfo configuratorBInfo,
      List setToInitialConfig,
      List setToSimpleConfig,
      LocationInfo info) {
    int configuratorSL = configuratorBInfo.getStartLevel();

    Integer sL0 = (Integer) bslToList.keySet().iterator().next(); // StartLevel == 0;
    List list0 = (List) bslToList.get(sL0);
    if (sL0.intValue() == 0)
      for (Iterator ite2 = list0.iterator(); ite2.hasNext(); ) {
        BundleInfo bInfo = (BundleInfo) ite2.next();
        if (isSystemBundle(bInfo.getLocation(), info)) {
          setToSimpleConfig.add(bInfo);
          break;
        }
      }

    for (Iterator ite = bslToList.keySet().iterator(); ite.hasNext(); ) {
      Integer sL = (Integer) ite.next();
      List list = (List) bslToList.get(sL);

      if (sL.intValue() < configuratorSL) {
        for (Iterator ite2 = list.iterator(); ite2.hasNext(); ) {
          BundleInfo bInfo = (BundleInfo) ite2.next();
          if (!isSystemBundle(bInfo.getLocation(), info)) setToInitialConfig.add(bInfo);
        }
      } else if (sL.intValue() > configuratorSL) {
        for (Iterator ite2 = list.iterator(); ite2.hasNext(); ) {
          BundleInfo bInfo = (BundleInfo) ite2.next();
          if (isPrerequisiteBundles(bInfo.getLocation(), info)
              || isSystemFragmentBundle(bInfo.getLocation(), info))
            if (!isSystemBundle(bInfo.getLocation(), info)) setToInitialConfig.add(bInfo);
          setToSimpleConfig.add(bInfo);
        }
      } else {
        boolean found = false;
        for (Iterator ite2 = list.iterator(); ite2.hasNext(); ) {
          BundleInfo bInfo = (BundleInfo) ite2.next();
          if (found) {
            if (!isSystemBundle(bInfo.getLocation(), info))
              if (isPrerequisiteBundles(bInfo.getLocation(), info)
                  || isSystemFragmentBundle(bInfo.getLocation(), info))
                setToInitialConfig.add(bInfo);
            setToSimpleConfig.add(bInfo);
            continue;
          }
          if (isTargetConfiguratorBundle(bInfo.getLocation())) found = true;
          else if (!isSystemBundle(bInfo.getLocation(), info)) setToInitialConfig.add(bInfo);
          setToSimpleConfig.add(bInfo);
        }
      }
    }

    setToInitialConfig.add(configuratorBInfo);
  }