一、使用命令行调用java程序
main函数中(//java从0命令行输入,而python从1)sys.argv[1]
Integer threadcount=Integer.parseInt(args[0]);
String file_in=args[1];
String file_out=args[2];
excute_in_main(threadcount, file_in,file_out);
java中字典按值排序
- List<Entry<String,Integer>> list =new ArrayList<Entry<String,Integer>>(dicHashMap.entrySet());
- Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
- public int compare(Map.Entry<String, Integer> o1,
- Map.Entry<String, Integer> o2) {
- return (o2.getValue() - o1.getValue());
- }
- });
- for (Entry<String,Integer> i: list){
- writerdic.write(i.getKey()+"\t"+i.getValue()+"\n");
- }
上述代码是讲map中的value按照逆序排序,如果需要按照升序进行排序的话,只需要修改o2.getValue() - o1.getValue()为o1.getValue() - o2.getValue()即可