![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaSE
孤独的狼2021
这个作者很懒,什么都没留下…
展开
-
实现网络下载文件功能
public class DownloadStartup { private static final String encoding = "utf-8"; public static void main(String[] args) { DownloadTask downloadManager = new DownloadTask(); // String urlStr =转载 2012-12-27 14:34:57 · 361 阅读 · 0 评论 -
Java序列化与反序列化
package com.io.test; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutp原创 2013-01-22 14:16:43 · 221 阅读 · 0 评论 -
java的反射机制
Reflection是Java 程序开发语言的特征之一,它允许运行中的 Java 程序对自身进行检查,或者说"自审",并能直接操作程序的内部属性。例如,使用它能获得 Java 类中各成员的名称并显示出来。 Java 的这一能力在实际应用中也许用得不是很多,但是在其它的程序设计语言中根本就不存在这一特性。例如,Pascal、C 或者 C++ 中就没有办法在程序中获得函数定义相关的信息。 JavaB原创 2013-02-05 15:58:52 · 315 阅读 · 0 评论 -
一个大整数相乘算法的例子
public class BigInts { public String BigIntAdd(String s1, String s2) throws IOException { IntString intt1 = new IntString(); String str = ""; IntString intt2 = new IntString(); intt1.digits =转载 2012-12-28 15:00:04 · 306 阅读 · 0 评论 -
GC工作机制
SUN的jvm内存池被划分为以下几个部分: Eden Space (heap) 内存最初从这个线程池分配给大部分对象。 Survivor Space (heap) 用于保存在eden space内存池中经过垃圾回收后没有被回收的对象。 Tenured Generation (heap) 用于保持已经在survivor space内存池中存在了一段时间的对象。 Permanent Ge转载 2012-12-28 14:55:00 · 291 阅读 · 0 评论 -
正则表达式
\ 将下一个字符标记为一个特殊字符、或一个原义字符、或一个向后引用、或一个八进制转义符。例如,“n”匹配字符“n”。“\n”匹配一个换行符。序列“\\”匹配“\”而“\(”则匹配“(”。 ^ 匹配输入字符串的开始位置。如果设置了RegExp对象的Multiline属性,^也匹配“\n”或“\r”之后的位置。 $ 匹配输入字符串的结束位置。如果设置了RegExp对象的Mu转载 2012-12-28 13:35:22 · 221 阅读 · 0 评论 -
仅仅一个工厂设计模式的例子
public interface IWorkFactory { public Work getWork(); } public class StudentWork implements Work{ public void dowork() { System.out.println("学生做作业!"); } } public class StudentWorkFactory implem转载 2012-12-27 14:41:30 · 266 阅读 · 0 评论 -
插入排序
public class InsertSort { public static void main(String[] args) { int[] array = {2,3,1,8,6}; System.out.print("排序前;"); printArray(array); insertAscSort(array); insertDescSort(array); }转载 2012-12-27 14:31:00 · 206 阅读 · 0 评论 -
选择排序
public class SelectSort { public static void main(String[] args) { int[] array = {23,10,7,12,5,1}; System.out.print("排序前;"); printArray(array); selectAscSort(array); selectDescSort(array);转载 2012-12-27 14:32:03 · 210 阅读 · 0 评论 -
冒泡排序
public class BubbleSort { public static void main(String[] args) { int[] array = {10,5,7,12}; System.out.print("排序前;"); printArray(array); bubbleAscSort(array); bubbleDescSort(array); } /** * 冒泡升序排序转载 2012-12-27 14:29:22 · 182 阅读 · 0 评论 -
dom4j 替换xml 节点元素
private static org.dom4j.Document replaceElement(File newXML, org.dom4j.Element connectionElement) { org.dom4j.Document doc = getDoc(newXML); org.dom4j.Element rootElement = doc.getRootEleme原创 2013-07-17 11:10:12 · 2599 阅读 · 1 评论