code: protected void init(String line) throws ProblemFormatException {
          StringTokenizer st = new StringTokenizer(line);
  
          try {
              this.id = st.nextToken();
              this.dimension = Integer.valueOf(st.nextToken());
              this.capacity = Integer.valueOf(st.nextToken());
  
              this.knapsackItems = new ArrayList<KnapsackItem>(this.dimension);
              for (int i = 0; i < dimension; i++) {
                  int weight = Integer.valueOf(st.nextToken());
                  int price = Integer.valueOf(st.nextToken());
                  this.knapsackItems.add(new KnapsackItem(i, weight, price));
              }
  
              if (st.hasMoreTokens())
                  throw new ProblemFormatException("Too many elements in line");
          } catch (NoSuchElementException e) {
              throw new ProblemFormatException("Insufficient number of elements in line");
          } catch (NumberFormatException e) {
              throw new ProblemFormatException("Non numeric elements found in line");
          }
  
          this.addOperations = new ArrayList<AddOperation>(this.dimension);
          this.removeOperations = new ArrayList<RemoveOperation>(this.dimension);
          AddOperation addTmp;
          RemoveOperation removeTmp;
  
          for (int i = 0; i < this.dimension; i++) {
              addTmp = new AddOperation(this.knapsackItems.get(i));
              removeTmp = new RemoveOperation(this.knapsackItems.get(i));
              // set reverses
              addTmp.setReverse(removeTmp);
              removeTmp.setReverse(addTmp);
              // add operations to list
              this.addOperations.add(addTmp);
              this.removeOperations.add(removeTmp);
          }
  
          List<Integer> tmp = new ArrayList<Integer>(this.dimension);
          for (int i = 0; i < this.dimension; ++i) tmp.add(0);
          this.startingConfiguration = new Configuration(tmp, "Empty knapsack created");
      }
docs: Init knapsack from one line of string. Expects format
  <p/>
  id dimension capacity weight1 price1 weight2 price2 ...  weightN priceN (all numeric)
  
  @param line string containing data to init this knapsack
  @throws ProblemFormatException if line format is invalid