code: public void saveAsFile(List<String> labels, String path) throws IOException {
          BufferedWriter write = null;
          try {
              write = new BufferedWriter(new FileWriter(new File(path)));
              for (int i = 0; i < Y.rows(); i++) {
                  if (i >= labels.size())
                      break;
                  String word = labels.get(i);
                  if (word == null)
                      continue;
                  StringBuilder sb = new StringBuilder();
                  INDArray wordVector = Y.getRow(i);
                  for (int j = 0; j < wordVector.length(); j++) {
                      sb.append(wordVector.getDouble(j));
                      if (j < wordVector.length() - 1)
                          sb.append(",");
                  }
  
                  sb.append(",");
                  sb.append(word);
                  sb.append("\n");
                  write.write(sb.toString());
  
              }
              write.flush();
              write.close();
          } finally {
              if (write != null)
                  write.close();
          }
      }
docs: Save the model as a file with a csv format, adding the label as the last column.
  @param labels
  @param path the path to write
  @throws IOException