package com.fr.tx.main;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.alibaba.fastjson.JSONObject;
import com.fr.tx.common.util.CrcUtil;

public class MyTest {

	public static void main(String[] args) {
		
		String gn1 = "14";
		String s = "{'sts':'68','Entity':'GunSts','gunNo':'"+gn1+"','St':'"+"ST000001"+"','sts':'01'}";
		JSONObject json = JSONObject.parseObject(s);
		System.out.println(json.toString());
		// TODO Auto-generated method stub
		System.out.println(Math.random()*0.9+0.4);
		System.out.println(String.valueOf(20*(Math.random()*0.25+0.17)));
		String res ="6801031f0119110808493500000075080000856619110808503200000088c200009e664e16";
		String beginString=res.substring(10,24);
		String endString=res.substring(40,54);
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		Date begin=hexToDate(beginString);
		Date end=hexToDate(endString);
		System.out.println(df.format(end));
		System.out.println(df.format(begin));
		
	}
	public static  Date hexToDate(String a){
		Date date = null;
		try {
			byte[] b=CrcUtil.stringTobytes(a);
			date=new Date(b[0]+100,b[1]-1,b[2],b[3],b[4],b[5]);
		} catch (Exception e) {
			// TODO: handle exception
		}
		return date;
	}
}
