JAVA
lost104974687
这个作者很懒,什么都没留下…
展开
-
hashCode相等
public static void main(String[] args) { String a = "/2010/6/13/19/766105207591607338053525248042284292/1.0"; String b = "/2010/10/8/19/766105208164534487403083462088868610/1.0"; System.out.println(a.hashCode()); System.out.println(b.hash原创 2011-04-20 11:24:00 · 607 阅读 · 1 评论 -
JAVA如何把一个float四舍五入到小数点后2位,4位,或者其它指定位数
(一):这种方法方便float a = 123.2334f; float b = (float)(Math.round(a*100))/100; //(这里的100就是2位小数点,如果要其它位,如4位,这里两个100改成10000) (二):这个方法也简单,不过还要再转成float型:import java.text.DecimalFormat; String a = new DecimalFormat("###,###,###.##").format(100.12345 ); (三):这原创 2011-04-20 11:31:00 · 593 阅读 · 0 评论 -
Excel导出
import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; HSSFSheet sheet = workbook.createSheet(); workbook.setShe原创 2011-04-20 11:57:00 · 454 阅读 · 0 评论 -
return List
<br />public static List convertList(ResultSet rs) throws SQLException{ List list = new ArrayList(); ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); while(rs.next()) { Map rowData = new Ha原创 2011-04-26 11:59:00 · 1217 阅读 · 0 评论