Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; public class Main { private static SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static HashMap<String, String> tran2Hash(String info) { HashMap<String, String> temp = new HashMap<String, String>(); String username = info.substring(0, info.indexOf(",")); info = info.substring(info.indexOf(",") + 1); String nickname = info.substring(0, info.indexOf(",")); info = info.substring(info.indexOf(",") + 1); String head = info.substring(0, info.indexOf(",")); info = info.substring(info.indexOf(",") + 1); String fanssum = info.substring(0, info.indexOf(",")); info = info.substring(info.indexOf(",") + 1); String verifytype = info.substring(0, info.indexOf(",")); info = info.substring(info.indexOf(",") + 1); String reposttime = info.substring(0, info.indexOf("=")); String repostercount = info.substring(info.indexOf("=") + 1); reposttime = getTime(Long.parseLong(reposttime)); temp.put("username", username); temp.put("nickname", nickname); temp.put("head", head); temp.put("fanssum", fanssum); temp.put("verifytype", verifytype); temp.put("reposttime", reposttime); temp.put("repostercount", repostercount); return temp; } public static String getTime(long time) { return format1.format(new Date(time * 1000l)); } }