ntwjf的博客
ntwjf · 共 4 篇文章
java poi导出excel
<body> <a href="servlet/DownLoadExcelServlet">下载表格</a> <br> </body> public class DownLoadExcelServlet extends HttpServlet { private static final long serialVersionUID = 1L; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost…
2016-01-07 16:17 · java · 评论(0)
java poi读写excel
1、读取excel2003 @Test //读取excel2003 public void testCreateXLS(){ try { String path = "f:\\app\\iotest\\n.xls.doc"; String postfix = (path.trim().lastIndexOf(".") == -1)?"":path.substring(path.trim().lastIndexOf(".") + 1); if("xls".equalsIgnoreCase(postfix) || "xlsx".equalsIgnoreCase(postfix)){ //创建工作…
2015-12-24 09:27 · java · 评论(0)
IO操作
1、文件读取 @Test public void testFileInputStream(){ InputStream in = null; try { in = new FileInputStream("f:/a/hello.txt"); int readCount = 0; byte[] buffer = new byte[1024]; while((readCount = in.read(buffer, 0, 1024)) != -1){ String str = new String(buffer,0,readCount); System.out.println(str); } } …
2015-06-10 09:30 · java · 评论(0)
递归应用
1、求阶乘 public int f1(int n){ if(n == 1){ return 1; }else{ return n * f1(n-1); } } 2、求Fibonacci数列的第n个数是多少 public int f2(int n){ if(n == 1 || n == 2){ return 1; }else{ return f2(n - 2) + f2(n - 1); } } 3、递归删除文件夹下所有文件 public void deleteFiles(File file){ if(file.isFile() || file.listFiles().length == 0)…
2015-05-05 16:56 · java · 评论(0)