JAVA¶ÁÊé±Ê¼Ç£¨¶þ£©
²Ù×÷·û
1.λ²Ù×÷·û
(a) >>>ÓÒÒÆ£¬¸ßλÓÃ0Ìî³ä£»
int a = 14;
int b = 2;
System.out.println(a >>> b);// 3
int c = -14;
int d = 2;
System.out.println(c >>> d);// 1073741820
(b) >>·ûºÅλ²»±ä£¬ÆäËûλÓÒÒÆ£¬¸ßλÓÃ0Ìî³ä£¬Æä½á¹ûÓëa/2bÏàͬ£»
int a = 14;
int b = 2;
System.out.println(a >> b);// 3
int c = -14;
int d = 2;
System.out.println(c >> d);// -4
System.out.println(Math.floor(a / Math.pow(2, b))); // 3.0
System.out.println(Math.floor(c / Math.pow(2, d))); // -4.0
(c) <<·ûºÅλ²»±ä£¬ÆäËûλ×óÒÆ£¬µÍλÓÃ0Ìî³ä£¬Æä½á¹ûÓëa×2bÏàͬ£»
int a = 14;
int b = 2;
System.out.println(a << b);// 56
int c = -14;
int d = 2;
System.out.println(c << d);// -56
System.out.println(Math.floor(a * Math.pow(2, b))); // 56.0
System.out.println(Math.floor(c * Math.pow(2, d))); // -56,0
(d) ¶ÔÓÚjava.util.MathÖеÄceil¼°floorº¯Êý£¬Òª×¢Òâ²ÎÊýµÄÀàÐÍ
int a = 14;
int b = 3;
System.out.println(Math.floor(a / b)); // 4
System.out.println(Math.ceil(a / b)); // 4
double c = 14d;
double d = 3d;
System.out.println(Math.floor(c / d)); // 4
System.out.println(Math.ceil(c / d)); // 5
ÈçÉÏËùʾ£ºÓÉÓÚaºÍbÁ½¸ö²ÎÊý¶¼ÊÇintÀàÐ͵ģ¬Òò´ËÔÚÖ´ÐÐa/bºó£¬»á×öÒ»¸öÒþʽµÄÀàÐÍת»»£¬½«½á¹ûת³ÉintÀàÐ͵ģ¬ÕâÑù¾Í»á½«Ð¡ÊýλÉáÆú¡£Òò´ËÔÚÓõ½ceilºÍfloorº¯Êýʱ£¬Ó¦¸Ã×¢Òâ±í´ïʽ¼ÆËãºóËùÉú³ÉµÄ½á¹ûµÄÊý¾ÝÀàÐÍ¡£
Ïà¹ØÎĵµ£º
Ò»¡¢Java ClassLoader
1£¬Ê²Ã´ÊÇClassLoader
Óë C »ò C++ ±àдµÄ³ÌÐò²»Í¬£¬Java ³ÌÐò²¢²»ÊÇÒ»¸ö¿ÉÖ´ÐÐÎļþ£¬¶øÊÇÓÉÐí¶à¶ÀÁ¢µÄÀàÎļþ×é³É£¬Ã¿Ò»¸öÎļþ¶ÔÓ¦ÓÚÒ»¸ö Java Àà¡£
´ËÍ⣬ÕâЩÀàÎļþ²¢·ÇÁ¢¼´È«²¿¶¼×°ÈëÄڴ棬¶øÊǸù¾Ý³ÌÐòÐèҪװÈëÄÚ´æ¡£ClassLoader ÊÇ JVM Öн«Àà×°ÈëÄÚ´æµÄÄDz¿·Ö¡£
¶øÇÒ£¬Java ClassLoader ......
1.final¹Ø¼ü×ÖÐÞÊÎÀàʱ£¬ËµÃ÷ÆäÀ಻ÄÜÓÐ×ÓÀ࣬Ҳ¾ÍÊÇ˵¸ÃÀ಻Äܱ»¼Ì³Ð£¬¸ÃÀàµÄ³ÉÔ±±äÁ¿ÔÚÕâÀォ²»Æð×÷Óá£
2.final¹Ø¼ü×ÖÐÞÊη½·¨Ê±£¬ËµÃ÷¸Ã·½·¨²»Äܱ»ÖØÐ´£¬ÒòΪÀà¶¼²»Äܱ»¼Ì³ÐÁË£¬·½·¨¾Í¸ü²»ÄÜÖØÐ´ÁË¡£
3.ÀàÀï¿ÉÒÔº¬ÓÐfinal¹Ø¼ü×ÖÐÞÊεķ½·¨¡£
4.ÔÚjavaÀ³éÏóÀà×îÉÙÒªº¬ÓÐÒ»¸ö³éÏó·½·¨£¬ÈÃËüµÄ×ÓÀàȥʵÏÖÕâ¸ö³éÏó·½· ......
import java.util.Enumeration;
public class CipherTest implements Enumeration {
private int N;
private int c[], k;
private Object[] objs;
public CipherTest(Object[] items) {
N = items.length;
c = new int[N + 1];
for (int i = 0; i <= N; i++)
c[i] = i;
objs = items;
k = 1 ......
×Ô¶¯×°ÏäºÍ×Ô¶¯²ðÏäÊÇ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
......
¡¡¡¡ÔÚÆ½Ê±¹¤×÷ÖУ¬ÄÑÃâ»áÓöµ½°Ñ XML ×÷ΪÊý¾Ý´æ´¢¸ñʽ¡£Ãæ¶ÔĿǰÖÖÀà·±¶àµÄ½â¾ö·½°¸£¬Äĸö×îÊʺÏÎÒÃÇÄØ£¿ÔÚÕâÆªÎÄÕÂÖУ¬ÎÒ¶ÔÕâËÄÖÖÖ÷Á÷·½°¸×öÒ»¸ö²»ÍêÈ«ÆÀ²â£¬½ö½öÕë¶Ô±éÀú XML Õâ¿éÀ´²âÊÔ£¬ÒòΪ±éÀú XML Êǹ¤×÷ÖÐʹÓÃ×î¶àµÄ£¨ÖÁÉÙÎÒÈÏΪ£©¡£
¡¡¡¡Ô¤ ±¸
¡¡¡¡²âÊÔ»·¾³£º
¡¡¡¡AMD ¶¾Áú1.4G OC 1.5G¡¢256M DDR333¡¢Wind ......