JAVA·½·¨µ÷ÓÃЧÂʲî±ð
¡¡¡¡×î½üÐèÒª×öһЩJAVAµ×²ã²Ù×÷£¬ÎªÁ˾¡¿ÉÄÜÌá¸ßЧÂÊ×öÁËÈçϲâÊÔ¡£
¡¡¡¡ÔÚͬһ¸öÀàÖн¨Á¢ÆÕͨµÄPUBLIC·½·¨ºÍPUBLIC STATIC ·½·¨Á½ÖÖ£¬²¢Ê¹ÓÃJUnit½øÐжà´ÎÑ»·¡£×îÖÕÖ¤Ã÷ʹÓöÔÏóµÄ·½Ê½µ÷ÓÃЧÂʸߡ£
¡¡¡¡ÉϽá¹û¡£
Æðʼʱ¼äFri Mar 05 10:15:37 CST 2010½áÊøʱ¼äFri Mar 05 10:15:38 CST 2010ʱ¼ä¼ä¸ô891
Æðʼʱ¼äFri Mar 05 10:15:38 CST 2010½áÊøʱ¼äFri Mar 05 10:15:39 CST 2010ʱ¼ä¼ä¸ô1047
Æðʼʱ¼äFri Mar 05 10:15:45 CST 2010½áÊøʱ¼äFri Mar 05 10:15:46 CST 2010ʱ¼ä¼ä¸ô875
Æðʼʱ¼äFri Mar 05 10:15:46 CST 2010½áÊøʱ¼äFri Mar 05 10:15:47 CST 2010ʱ¼ä¼ä¸ô1046
Æðʼʱ¼äFri Mar 05 10:15:55 CST 2010½áÊøʱ¼äFri Mar 05 10:15:56 CST 2010ʱ¼ä¼ä¸ô891
Æðʼʱ¼äFri Mar 05 10:15:56 CST 2010½áÊøʱ¼äFri Mar 05 10:15:57 CST 2010ʱ¼ä¼ä¸ô1047
¡¡¡¡ÉÏ´úÂë
package efficiency;
public class Efficiency {
public void eff() {
int a = 0;
for (int i = 0; i < 10000; i++) {
a += i;
}
}
public static void eff1() {
int a = 0;
for (int i = 0; i < 10000; i++) {
a += i;
}
}
}
package efficiency;
import org.junit.Test;
public class EfficiencyTest {
@Test
public void testEff() {
long st = new java.util.Date().getTime();
for (int i = 0; i < 100000; i++) {
new Efficiency().eff();
}
long en = new java.util.Date().getTime();
System.out.println("Æðʼʱ¼ä" + new java.util.Date(st) + "½áÊø
Ïà¹ØÎĵµ£º
windows xpÏÂÅäÖÃJDK»·¾³±äÁ¿£º
1.°²×°JDK£¬°²×°¹ý³ÌÖпÉÒÔ×Ô¶¨Ò尲װĿ¼µÈÐÅÏ¢£¬ÀýÈçÎÒÃÇÑ¡Ôñ°²×°Ä¿Â¼ÎªD:\java\jdk1.5.0_08£»
¡¡ 2.°²×°Íê³Éºó£¬ÓÒ»÷“ÎҵĵçÄÔ”£¬µã»÷“ÊôÐÔ”£»
3.Ñ¡Ôñ“¸ß¼¶”Ñ¡Ï£¬µã»÷“ ......
½ñÌìÓöµ½Ò»¸öÒªÉú³ÉÒ»¸öÏÂÀÁбí¿òµÄÎÊÌ⣬ÎÒµÄÏë·¨ÊÇ£º½«Êý¾Ý¿âÄÚµÄËùÓÐÊý¾Ý¶¼´æ´¢µ½Ò»¸öListÀïÃ棬ÔÙÔÚǰ̨±éÀúÕû¸ölist¡£
Ö´ÐÐЧ¹ûͼ£º
Ë®¹û
→Æ»¹û
→→Æ»¹ûϵÁÐ1
→→Æ»¹ûϵÁÐ2
→→Æ»¹ûϵÁÐ3
→→Æ»¹ûϵÁÐ4
→Àæ
→ÌÒ×Ó
ѧϰÓÃÆ·
→±Ê
→→Ǧ±Ê ......
1, ±£Ö¤Ḭ̈߳²È«µÄÈýÖÖ·½·¨ :
a, ²»Òª¿çÏ̷߳ÃÎʹ²Ïí±äÁ¿
b, ʹ¹²Ïí±äÁ¿ÊÇ finalÀàÐ͵Ä
c, ½«¹²Ïí±äÁ¿µÄ²Ù×÷¼ÓÉÏͬ²½
2, Ò»¿ªÊ¼¾Í½«ÀàÉè¼Æ³ÉḬ̈߳²È«µÄ , ±ÈÔÚºóÆÚÖØÐÂÐÞ¸´Ëü ,¸üÈÝÒ× .
3, ±àд¶àÏ̳߳ÌÐò , Ê×Ïȱ£Ö¤ËüÊÇÕýÈ·µÄ , Æä´ÎÔÙ¿¼ÂÇÐÔÄÜ .
4, ÎÞ״̬»òÖ»¶Á¶ÔÏóÓÀÔ¶ÊÇḬ̈߳²È«µÄ .
5, ²»Òª½«Ò»¸ö¹²Ïí±äÁ¿Âã ......
<%
//header.jsp
out.println("Protocol: " + request.getProtocol() + "<br>");
out.println("Scheme: " + request.getScheme() + "<br>");
out.println("Server Name: " + request.getServerName() + "<br>" );
out.println(&quo ......
Apache MINA (mina-2.0.0-M6Ô´ÂëΪÀý):
ÎÒÃÇʹÓÃmina nio tcp×î³£ÓõÄÑùÀýÈçÏÂ:
NioSocketAcceptor acceptor = new NioSocketAcceptor(/*NioProcessorPool's size*/);
DefaultIoFilterChainBuilder cha ......