![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
nobody_2008
这个作者很懒,什么都没留下…
展开
-
Calendar类getActualMaximum方法与getMaximum方法
在编写一个计算季度开始时间和结束时间的代码时,发现有些季度的结束年月不正确,比实际大了一天。代码如下:/** * 得到某一时间所在季度的开始时间 * * @param cal * 要判断的时间 * @return */ private Calendar getStartCalOfQuarter(Calendar cal) {...2010-08-31 12:29:28 · 3376 阅读 · 0 评论 -
一个简单的字符串补充其他字符的方法
从今天以前,我都是用循环做补充字符串的放的方法的…… 方法很简单,用n个要补充的字符的字符串与目标字符串相连,然后截取字符串就可以了。 例子:一个数字不足六位时左侧补0 的方法。 String resultStr="0000000"+str;resultStr=resultStr.substring(resultStr.length()-6);...原创 2010-09-01 14:00:49 · 232 阅读 · 0 评论 -
java.lang.ClassCastException: java.math.BigDecimal
类型转换错误,无法有BigDecimal转换到目标类型。 转换为int:int count = ((BigDecimal) bybHm[i].get("count")).intValue() 转换为double:double count = ((BigDecimal) bybHm[i].get("count")).doubleValue() 转换为float:f...原创 2010-09-03 13:50:18 · 437 阅读 · 0 评论 -
我喜欢的一个HashMap排序方法
Map hashMap = new HashMap();List arrayList = new ArrayList(hashMap.entrySet());Collections.sort(arrayList, new Comparator() { public int compare(Object o1, Object o2) { Map.Entry obj1 = (Ma...原创 2010-09-03 23:52:11 · 90 阅读 · 0 评论 -
HashMap的遍历
第一种: HashMap<String,String> tempHm=new HashMap<String,String>(); tempHm.put("a", "A"); tempHm.put("b", "B"); tempHm.put("c", "C"); Collection<2011-03-07 22:09:51 · 127 阅读 · 0 评论