Java tutorial
//package com.java2s; import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Map; public class Main { public static <K, V> void printMap(Map<K, V> A, File file) throws FileNotFoundException, UnsupportedEncodingException { file.getParentFile().mkdirs(); PrintWriter p = new PrintWriter(file, "UTF-8"); for (K k : A.keySet()) p.println(k + "\t" + A.get(k)); p.close(); } }