public static void writeHistogram(TDoubleDoubleHashMap map,String keyCol,String valCol,String file,boolean descending) throws IOException {
  BufferedWriter writer=new BufferedWriter(new FileWriter(file));
  writer.write(keyCol);
  writer.write(TAB);
  writer.write(valCol);
  writer.newLine();
  double[] keys=map.keys();
  Arrays.sort(keys);
  if (descending)   ArrayUtils.reverse(keys);
  for (  double key : keys) {
    writer.write(String.valueOf(key));
    writer.write(TAB);
    writer.write(String.valueOf(map.get(key)));
    writer.newLine();
  }
  writer.close();
}

public static void writeHistogram ( TDoubleDoubleHashMap map , String keyCol , String valCol , String file , boolean descending ) throws IOException { BufferedWriter writer = new BufferedWriter ( new FileWriter ( file ) ) ; writer . write ( keyCol ) ; writer . write ( TAB ) ; writer . write ( valCol ) ; writer . newLine ( ) ; double [ ] keys = map . keys ( ) ; Arrays . sort ( keys ) ; if ( descending ) ArrayUtils . reverse ( keys ) ; for ( double key : keys ) { writer . write ( String . valueOf ( key ) ) ; writer . write ( TAB ) ; writer . write ( String . valueOf ( map . get ( key ) ) ) ; writer . newLine ( ) ; } writer . close ( ) ; }
writes a plain text file with two columns where the first column contains the map keys and second the map values .
