摘要: 方法一: 最多人使用的一个方法, 直观, 方便, 但效率很低.1:if(s == null || s.equals(""));方法二: 比较字符串长度, 效率高, 是我知道的最好一个方法.2:if(s == null || s.length() <= 0);方法三: Java SE 6.0 才开始提... 阅读全文
posted @ 2015-07-08 10:37 emanlee 阅读(4577) 评论(0) 推荐(0) 编辑
摘要: Java float保留两位小数或多位小数方法1:用Math.round计算,这里返回的数字格式的. float price=89.89;int itemNum=3;float totalPrice=price*itemNum;float num=(float)(Math.round(totalPr... 阅读全文
posted @ 2015-07-08 10:36 emanlee 阅读(1423) 评论(0) 推荐(0) 编辑