花间一壶酒

导航

03 2014 档案

Double 保留小数点后N位
摘要:/** * parse double f to num decimals * @param f * @param num the decimal number * @return the format number */ public double decimalNum(double f, int num) { BigDecimal bg = new BigDecimal(f); double f1 = bg.setScale(num, BigDecimal.ROUND_HALF_UP).doubleValue(); return f1; } 阅读全文

posted @ 2014-03-28 15:56 wrh526 阅读(244) 评论(0) 推荐(0)

java获取当前日期所在的周的周一,并以周一为一周开始
摘要:public String getMonday(String date) { if (date == null || date.equals("")) { System.out.println("date is null or empty"); return "0000-00-00 00:00:00"; } SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date d = null; try { d = forma... 阅读全文

posted @ 2014-03-28 15:55 wrh526 阅读(4236) 评论(0) 推荐(0)