Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java×Ô¶¯×°Ïä¡¢×Ô¶¯²ðÏäºÍÕý³£Çé¿öÐÔÄܱȽÏ

×Ô¶¯×°ÏäºÍ×Ô¶¯²ðÏäÊÇjava5.0°æ±¾ÒýÈëµÄ£¬ÄÜ×Ô¶¯½«»ù±¾ÀàÐÍת»»Îª¶ÔÓ¦µÄ»ù±¾ÀàÐͰü×°¶ÔÏó£¬ÄÇôÎÒÃDZȽÏÒ»ÏÂËûÃǵÄÐÔÄÜÇé¿ö¡£
package com.wmmad.test;
import junit.framework.TestCase;
/**
* @author madding.lip
*
* <pre>
* class: compare the autoboxing and unboxing and normal's performance
* </pre>
*
*/
@SuppressWarnings("unused")
public class BoxTest extends TestCase {
public static void main(String[] args) {
testAutoboxing();
testUnboxing();
testChangeToObject();
testChangeToData();
testNormal();
testNormal1();
}
public static void testAutoboxing() {
long start = System.currentTimeMillis();
Integer result = 0;
for (int i = 0; i < 1000000000; i++) {
result = i; // autoboxing
}
long end = System.currentTimeMillis();
System.out.println("autoboxing use time is£º " + (end - start) + "ms");
}
public static void testUnboxing() {
int result = 0;
long start = System.currentTimeMillis();
for (Integer i = 0; i < 1000000000; i++) {
result = i;
}
long end = System.currentTimeMillis();
System.out.println("unboxing use time is£º " + (end - start) + "ms");
}

public static void testChangeToObject() {
Integer result = 0;
long start = System.currentTimeMillis();
for(int i = 0; i < 1000000000; i++) {
result = (Integer)i;
}
long end = System.currentTimeMillis();
System.out.println("change to object use time is: " + (end - start) + "ms");
}

public static void testChangeToData() {
int result = 0;
long start = System.currentTimeMillis();
for(Integer i = 0; i < 1000000000; i++) {
result = i.intValue();
}
long end = System.currentTimeMillis();
System.out.println("change to data use time is: " + (end - start) + "ms");
}
public static void testNormal() {
int result = 0;
long start = System.currentTimeMillis();
for (int i = 0; i


Ïà¹ØÎĵµ£º

È«ÇòʯÓÍÍøÕÐÆ¸java¹¤³Ìʦ

È«ÇòʯÓÍÍø£¨www.cippe.net£©´´½¨ÓÚ2004Äê£¬ÖØµã±¨µÀÈ«ÇòʯÓ͹¤ÒµÐ²úÆ·¡¢Ð¼¼Êõ£¬¼á³ÖÆ·ÅÆ»¯¡¢×¨Òµ»¯¡¢¹ú¼Ê»¯µÄÕ½ÂÔ·¢Õ¹·½Ïò£¬´Ù½øÈ«ÇòʯÓ͹¤Òµ¼¼Êõ½»Á÷Óë×°±¸Ã³Ò×£¬ÍƽøÖйúʯÓ͹¤Òµ»¯·¢Õ¹ËÙ¶È£¡
ÍøÕ¾º­¸ÇµØÖÊ¿±Ì½¡¢ÓÍÆø²Ø¡¢×ê¾®¡¢²â¾®¡¢²ÉÓÍ¡¢×°±¸¡¢º£ÑóʯÓÍ¡¢´¢ÔË¡¢Á¶»¯µÈרҵÁìÓò£¬´´°ìÁËʯÓÍ×ÊѶ¡¢Ð²úƷм¼Êõ¡¢Ê¯Ó ......

Java¿É±ä²ÎÊýÁбí

public class TestClass{
public static void main(String args[]){
VarArgs(1, "one");
VarArgs(2, "one", "two");
VarArgs(3, "one", "two", "three");
VarArgs(0); // Attention!
}
static void VarArgs(int nRequired, String... trailing){
System.out.print("Required: " + nRequired + " "); ......

Java Concurrent°üѧϰ֮ConcurrentHashMap

ÔÚJava concurrent°üÖÐÓÐÕâôһ¸ö½Ó¿Ú£ºConcurrentMap¡£
ConcurrentMap¼Ì³Ð×ÔMap£¬²¢Ìí¼ÓÁ˼¸¸öеÄÔ­×Ó·½·¨£º putIfAbsent¡¢remove¡¢replace
Æä·½·¨ÕªÒªÈçÏ£º
 V
putIfAbsent(K key, V value)
          Èç¹ûÖ¸¶¨¼üÒѾ­²»ÔÙÓëij¸öÖµÏà¹ØÁª£¬Ôò½ ......

JAVA JNI

http://blog.csdn.net/hbcui1984/archive/2009/12/10/4980805.aspx
Ò»¡¢¸ÅÊö
JNI(java native interface)£¬JAVA±¾µØ½Ó¿Úµ÷Óã¬Ä¿µÄÊÇΪÁËJAVA¿ÉÒÔµ÷Óñ¾µØ³ÌÐò£¬Ö÷ÒªÓŵãÓУº
Ìá¸ßЧÂÊ£¬½â¾öÐÔÄÜÎÊÌâ
·ÀÖ¹·´±àÒ룬Ìá¸ßºËÐÄ´úÂ밲ȫÐÔ
ÔöÇ¿±¾»ú½Ó¿Úµ÷ÓÃ
ǶÈëʽ¿ª·¢Ó¦ÓÃ
    ÈçÏÂͨ¹ýÒ»¸ö×î¼òµ¥µÄÐ ......

3des¼ÓÃÜËã·¨µÄJavaʵÏÖ

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public class CipherTest {
public static void main(String[] args) {
try {
byte[] keydata = { (byte) 0x00, (byte) 0x01, (byte) 0x02,
(byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ