摘要: //数组拷贝 public class Test { public static void main(String[] args) { String[] s = {"Microsoft", "IBM", "Sun", "Oracle", "Apple"}; String[] sCopy = new String[6]; System.arraycopy(s, 0, sCopy, 0, s.length); for(int i = 0; i < s.length; i++) { System 阅读全文
posted @ 2012-04-29 23:23 spring3 阅读(201) 评论(0) 推荐(0) 编辑
摘要: public class ThreeOut { public static void main(String[] args) { boolean[] arr = new boolean[500]; for(int i = 0; i < arr.length; i++) { arr[i] = true; } int leftCount = arr.length; int countNum = 0; int index = 0; while(leftCount > 1) { if(arr[index] == true) { count... 阅读全文
posted @ 2012-04-29 16:02 spring3 阅读(137) 评论(0) 推荐(0) 编辑
摘要: public class TestSort { public static void main(String[] args) { Date[] days = new Date[5]; days[0] = new Date(2004, 8, 6); days[1] = new Date(2007, 4, 6); days[2] = new Date(2007, 4, 9); days[3] = new Date(2004, 4, 6); days[4] = new Date(2004, 4, 5); bubbleSort(days); for(in... 阅读全文
posted @ 2012-04-29 15:23 spring3 阅读(137) 评论(0) 推荐(0) 编辑
摘要: public class Test { public static void main(String[] args) { if(args.length < 3) { System.out.println(" ==!"); System.exit(-1); } double d1 = Double.parseDouble(args[0]); double d2 = Double.parseDouble(args[2]); double d = 0; if(args[1].equals("+")) { d = d1 + d2; } ... 阅读全文
posted @ 2012-04-29 13:49 spring3 阅读(136) 评论(0) 推荐(0) 编辑
摘要: public class Test { public static void main(String[] args) { int a[] = { 3, 9, 8}; //静态初始化 Date days1 [] = { new Date(1, 4, 2004), new Date(2, 4, 2004), new Date(3, 4, 2004) }; //动态初始化 Date [] days2 = new Date[3]; for (int i = 0; i < 3; i++) { days2[i] = ... 阅读全文
posted @ 2012-04-29 11:05 spring3 阅读(196) 评论(0) 推荐(0) 编辑