code: private double[] getIDFArray(BagOfTokens bag) {
      double[] idfArray = new double[bag.size()];
      Iterator it = bag.tokenIterator();
      int i = 0;
      while (it.hasNext()) {
        Token tok = (Token) it.next();
        idfArray[i] = bag.getWeight(tok);
        i++;
      }
      return idfArray;
    }
docs: getIDFArray normalize a vector of IDF weights.
  
  @param bag BagOfTokens
  @return double[]