摘要: public static void delDir(File f) { // 判断是否是一个目录, 不是的话跳过, 直接删除; 如果是一个目录, 先将其内容清空. if(f.isDirectory()) { // 获取子文件/目录 File[] subFiles = f.listFiles(); / 阅读全文
posted @ 2018-06-14 23:46 0扬帆启航0 阅读(224) 评论(0) 推荐(0) 编辑
摘要: public class ShellSort { public void shellSort(int[] array, int n) { int i, j, gap; int temp; for (gap = n / 2; gap > 0; gap /= 2) {// 计算gap大小 for (i 阅读全文
posted @ 2018-05-26 14:48 0扬帆启航0 阅读(85) 评论(0) 推荐(0) 编辑
摘要: class ArrayTool{ //最大值 public static int getMax(int[] arr) { int max=0; for (int x=0;x<arr.length ;x++ ) { if (arr[x]>arr[max]) { max =x; } } return a 阅读全文
posted @ 2018-05-26 14:45 0扬帆启航0 阅读(127) 评论(0) 推荐(0) 编辑
摘要: import java.math.BigDecimal; public class Test{ public static void main(String[] args){BigDecimal a = new BigDecimal(Double.toString(2.0));BigDecimal 阅读全文
posted @ 2018-05-21 21:43 0扬帆启航0 阅读(175) 评论(0) 推荐(0) 编辑
摘要: public class 类名{ static boolean foo(char c) { System.out.print(c); return true; } public static void main( String[] argv ) { int i =1; for ( foo('A'); 阅读全文
posted @ 2018-05-21 15:41 0扬帆启航0 阅读(591) 评论(1) 推荐(0) 编辑
摘要: public class 文件名 { /** *十进制转二进制. */ public static void main ( String args[] ) { // 无返回参数的方法直接运行 printBinary(2); } static void printBinary(int i) { Sys 阅读全文
posted @ 2018-05-21 10:20 0扬帆启航0 阅读(87) 评论(0) 推荐(0) 编辑
摘要: /***相传国际象棋是古印度舍罕王的宰相达依尔发明的。*舍罕王十分喜欢,决定让宰相自己选择赏赐。*这位宰相指着8×8共64格的棋盘说:陛下,请您赏给我一些麦子吧,*在棋盘的第一个格子放1粒,第2格放2粒,第3格放4粒,*以后每一格都比前一格增加一倍,依此放完棋盘上的64个格子,我就感恩不尽了。*舍罕 阅读全文
posted @ 2018-05-19 21:59 0扬帆启航0 阅读(333) 评论(0) 推荐(0) 编辑