/**
   * Updates the interal bitset from <code>iterator</code>. This will set <code>validMask</code> to
   * true if <code>iterator</code> is non-null.
   */
  private void updateMask(AttributedCharacterIterator iterator) {
    if (iterator != null) {
      validMask = true;
      this.iterator = iterator;

      // Update the literal mask
      if (literalMask == null) {
        literalMask = new BitSet();
      } else {
        for (int counter = literalMask.length() - 1; counter >= 0; counter--) {
          literalMask.clear(counter);
        }
      }

      iterator.first();
      while (iterator.current() != CharacterIterator.DONE) {
        Map attributes = iterator.getAttributes();
        boolean set = isLiteral(attributes);
        int start = iterator.getIndex();
        int end = iterator.getRunLimit();

        while (start < end) {
          if (set) {
            literalMask.set(start);
          } else {
            literalMask.clear(start);
          }
          start++;
        }
        iterator.setIndex(start);
      }
    }
  }
  public static void main(String[] args) {

    // Initialized to false by default
    BitSet bitmap = new BitSet(10000000);
    BufferedReader br = null;
    String line = null;

    try {

      br = new BufferedReader(new FileReader(args[0]));

      // Setting the bitmap for the input values
      while ((line = br.readLine()) != null) {
        int num = Integer.parseInt(line);
        bitmap.set(num);
      }

      // Outputting the sorted value
      for (int i = 0; i < bitmap.length(); i++) {

        if (bitmap.get(i)) {
          System.out.println(bitmap.get(i));
        }
      }
    } catch (Exception e) {

      e.printStackTrace();
    }
  }