public void printFullFeatureMatrix(PrintWriter pw) {
    String sep = "\t";
    for (int i = 0; i < featureIndex.size(); i++) {
      pw.print(sep + featureIndex.get(i));
    }
    pw.println();
    for (int i = 0; i < labels.length; i++) {
      pw.print(labelIndex.get(i));
      Set<Integer> feats = new HashSet<Integer>();
      for (int j = 0; j < data[i].length; j++) {
        int feature = data[i][j];
        feats.add(Integer.valueOf(feature));
      }
      for (int j = 0; j < featureIndex.size(); j++) {
        if (feats.contains(Integer.valueOf(j))) {
          pw.print(sep + '1');
        } else {
          pw.print(sep + '0');
        }
      }
    }
  }
public void printFullFeatureMatrix ( PrintWriter pw ) { String sep = "\t" ; for ( int i = 0 ; i < featureIndex . size ( ) ; i ++ ) { pw . print ( sep + featureIndex . get ( i ) ) ; } pw . println ( ) ; for ( int i = 0 ; i < labels . length ; i ++ ) { pw . print ( labelIndex . get ( i ) ) ; Set < Integer > feats = new HashSet < Integer > ( ) ; for ( int j = 0 ; j < data [ i ] . length ; j ++ ) { int feature = data [ i ] [ j ] ; feats . add ( Integer . valueOf ( feature ) ) ; } for ( int j = 0 ; j < featureIndex . size ( ) ; j ++ ) { if ( feats . contains ( Integer . valueOf ( j ) ) ) { pw . print ( sep + '1' ) ; } else { pw . print ( sep + '0' ) ; } } } }
prints the full feature matrix in tab-delimited form.  These can be BIG
matrices, so be careful!