JavaµÝ¹é
Java±éÀúÎļþ¼ÐµÄ2ÖÖ·½·¨£º
A.²»Ê¹Óõݹ飺
import java.io.File;
import java.util.LinkedList;
public class FileSystem {
public static void main(String[] args) {
long a = System.currentTimeMillis();
LinkedList list = new LinkedList();
File dir = new File("c:\\java\\");
File file[] = dir.listFiles();
for (int i = 0; i < file.length; i++) {
if (file[i].isDirectory())
list.add(file[i]);
else
System.out.println(file[i].getAbsolutePath());
}
File tmp;
while (!list.isEmpty()) {
tmp = list.removeFirst();
if (tmp.isDirectory()) {
file = tmp.listFiles();
if (file == null)
continue;
for (int i = 0; i < file.length; i++) {
if (file[i].isDirectory())
list.add(file[i]);
else
System.out.println(file[i].getAbsolutePath());
}
} else {
System.out.println(tmp.getAbsolutePath());
}
}
System.out.println(System.currentTimeMillis() - a);
}
}
B.ʹÓõݹ飺
import java.io.File;
import java.util.ArrayList;
public class FileSystem1 {
private static ArrayList filelist = new ArrayList();
public static void main(String[] args) {
long a = System.currentTimeMillis();
refreshFileList("c:\\java");
System.out.println(System.currentTimeMillis() - a);
}
public static void refreshFileList(String strPath) {
File dir = new File(strPath);
File[] files = dir.listFiles();
if (files == null)
return;
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
refreshFileList(files[i].getAbsolutePath());
} else {
Strin
Ïà¹ØÎĵµ£º
ÊÀ½çÉϲ¢Ã»ÓгÉΪ¸ßÊֵĽݾ¶£¬µ«Ò»Ð©»ù±¾ÔÔòÊÇ¿ÉÒÔ×ñѵġ£
1¡¢ÔúʵµÄ»ù´¡
Êý¾Ý½á¹¹¡¢ÀëÉ¢Êýѧ¡¢±àÒëÔÀí£¬ÕâЩÊÇËùÓмÆËã»ú¿ÆѧµÄ»ù´¡£¬Èç¹û²»ÕÆÎÕËüÃÇ£¬ºÜÄÑд³ö¸ßˮƽµÄ³ÌÐò¡£³ÌÐòÈËÈ˶¼»áд£¬µ«µ±Äã·¢ÏÖдµ½Ò»¶¨³Ì¶ÈºÜÄÑÔÙÌá¸ßµÄʱºò£¬¾ÍÓ¦¸ÃÏëÏëÊDz»ÊÇÒª»Ø¹ýÍ·À´Ñ§Ñ§ÕâЩ×î»ù±¾µÄÀíÂÛ¡£²»ÒªÒ»¿ªÊ¼¾ÍÈ ......
<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@ËÎÌå" ......
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.font.TextAttribute;
import java.awt.image.BufferedImage;
import java.io.FileOutputStream;
import java.text.AttributedCharacterIterator;
import java.text. ......
/*
* ººÅµËþ£¬´ÓµÚ1¸öÖù×Ó½èÖúµÚ2¸ùÖù×ÓÒƶ¯µ½µÚ3¸ù
*/
public class TowerOfHano {
private int totle;//×ܹ²ÅÌ×ÓÊýÄ¿
public TowerOfHano(int totle){
this.totle=totle;
}
&nb ......