public void writeVecor(File ftrain,File ftest,File all,File trainLabel) throws Exception {
  int labels[]=readLabels();
  FileWriter fw=new FileWriter(ftrain);
  FileWriter fwt=new FileWriter(ftest);
  FileWriter flabel=new FileWriter(trainLabel);
  for (int i=0; i < dataNum; i++) {
    if (TestTrain[i] == 1) {
      flabel.write(String.valueOf(labels[i]) + '\n');
      for (int j=0; j < dimension; j++) {
        if (j != dimension - 1) {
          fw.write(String.valueOf(W[i][j]) + " ");
        }
 else {
          fw.write(String.valueOf(W[i][j]) + '\n');
        }
      }
    }
 else {
      for (int j=0; j < dimension; j++) {
        if (j != dimension - 1) {
          fwt.write(String.valueOf(W[i][j]) + " ");
        }
 else {
          fwt.write(String.valueOf(W[i][j]) + '\n');
        }
      }
    }
  }
  fw.close();
  fwt.close();
  flabel.close();
  FileWriter fwall=new FileWriter(all);
  for (int i=0; i < dataNum; i++) {
    for (int j=0; j < dimension; j++) {
      if (j != dimension - 1) {
        fwall.write(String.valueOf(W[i][j]) + " ");
      }
 else {
        fwall.write(String.valueOf(W[i][j]) + '\n');
      }
    }
  }
  fwall.close();
}

public void writeVecor ( File ftrain , File ftest , File all , File trainLabel ) throws Exception { int labels [ ] = readLabels ( ) ; FileWriter fw = new FileWriter ( ftrain ) ; FileWriter fwt = new FileWriter ( ftest ) ; FileWriter flabel = new FileWriter ( trainLabel ) ; for ( int i = 0 ; i < dataNum ; i ++ ) { if ( TestTrain [ i ] == 1 ) { flabel . write ( String . valueOf ( labels [ i ] ) + '\n' ) ; for ( int j = 0 ; j < dimension ; j ++ ) { if ( j != dimension - 1 ) { fw . write ( String . valueOf ( W [ i ] [ j ] ) + " " ) ; } else { fw . write ( String . valueOf ( W [ i ] [ j ] ) + '\n' ) ; } } } else { for ( int j = 0 ; j < dimension ; j ++ ) { if ( j != dimension - 1 ) { fwt . write ( String . valueOf ( W [ i ] [ j ] ) + " " ) ; } else { fwt . write ( String . valueOf ( W [ i ] [ j ] ) + '\n' ) ; } } } } fw . close ( ) ; fwt . close ( ) ; flabel . close ( ) ; FileWriter fwall = new FileWriter ( all ) ; for ( int i = 0 ; i < dataNum ; i ++ ) { for ( int j = 0 ; j < dimension ; j ++ ) { if ( j != dimension - 1 ) { fwall . write ( String . valueOf ( W [ i ] [ j ] ) + " " ) ; } else { fwall . write ( String . valueOf ( W [ i ] [ j ] ) + '\n' ) ; } } } fwall . close ( ) ; }
write the trained embedding to certain files .
