Java½â»ó3 34±»ÆæÊý»÷µ¹ÁË
ÓëÃÕÌâ26ºÍ27ÖеijÌÐòÒ»Ñù£¬ÏÂÃæµÄ³ÌÐòÓÐÒ»¸öµ¥ÖصÄÑ»·£¬Ëü¼Ç¼µü´úµÄ´ÎÊý£¬²¢ÔÚÑ»·ÖÕֹʱ´òÓ¡Õâ¸öÊý¡£ÄÇô£¬Õâ¸ö³ÌÐò»á´òÓ¡³öʲôÄØ£¿
public class Count {
public static void main(String[] args) {
final int START = 2000000000;
int count = 0;
for (float f = START; f < START + 50; f++)
count++;
System.out.println(count);
}
}
±íÃæµÄ·ÖÎöÒ²Ðí»áÈÏΪÕâ¸ö³ÌÐò½«´òÓ¡50£¬±Ï¾¹£¬Ñ»·±äÁ¿£¨f£©±»³õʼ»¯Îª2,000,000,000£¬¶øÖÕÖ¹Öµ±È³õʼֵ´ó50£¬²¢ÇÒÕâ¸öÑ»·¾ßÓд«Í³µÄ“°ë¿ª”ÐÎʽ£ºËüʹÓõÄÊÇ < ²Ù×÷·û£¬ÕâÊǵÄËü°üÀ¨³õʼֵµ«ÊDz»°üÀ¨ÖÕÖ¹Öµ¡£
È»¶ø£¬ÕâÖÖ·ÖÎöÒÅ©Á˹ؼüµÄÒ»µã£ºÑ»·±äÁ¿ÊÇfloatÀàÐ͵ģ¬¶ø·ÇintÀàÐ͵ġ£»ØÏëÒ»ÏÂÃÕÌâ28£¬ºÜÃ÷ÏÔ£¬ÔöÁ¿²Ù×÷£¨f++£©²»ÄÜÕý³£¹¤×÷¡£FµÄ³õʼֵ½Ó½üÓÚInteger.MAX_VALUE£¬Òò´ËËüÐèÒªÓÃ31λÀ´¾«È·±íʾ£¬¶øfloatÀàÐÍÖ»ÄÜÌṩ24λµÄ¾«¶È¡£¶ÔÈç´Ë¾Þ´óµÄÒ»¸öfloatÊýÖµ½øÐÐÔöÁ¿²Ù×÷½«²»»á¸Ä±äÆäÖµ¡£Òò´Ë£¬Õâ¸ö³ÌÐò¿´ÆðÀ´Ó¦¸ÃÎÞÏÞµØÑ»·ÏÂÈ¥£¬ÒòΪfÓÀÔ¶Ò²²»¿ÉÄܽâ¾öÆäÖÕÖ¹Öµ¡£µ«ÊÇ£¬Èç¹ûÄãÔËÐиóÌÐò£¬¾Í»á·¢ÏÖËü²¢Ã»ÓÐÎÞÏÞÑ»·ÏÂÈ¥£¬ÊÂʵÉÏ£¬ËüÁ¢¼´¾ÍÖÕÖ¹ÁË£¬²¢´òÓ¡³ö0¡£Ôõô»ØÊÂÄØ£¿
ÎÊÌâÔÚÓÚÖÕÖ¹Ìõ¼þ²âÊÔʧ°ÜÁË£¬Æ䷽ʽÓëÔöÁ¿²Ù×÷ʧ°ÜµÄ·½Ê½·Ç³£ÏàËÆ¡£Õâ¸öÑ»·Ö»ÓÐÔÚÑ»·Ë÷Òýf±È(float)(START + 50)СµÄÇé¿öϲÅÔËÐС£ÔÚ½«Ò»¸öintÓëÒ»¸öfloat½øÐбȽÏʱ£¬»á×Ô¶¯Ö´ÐдÓintµ½floatµÄÌáÉý[JLS 15.20.1]¡£Òź¶µÄÊÇ£¬ÕâÖÖÌáÉýÊǻᵼÖ¾«¶È¶ªÊ§µÄÈýÖÖÍØ¿íÔʼÀàÐÍת»»µÄÒ»ÖÖ[JLS 5.1.2]¡££¨ÁíÍâÁ½¸öÊÇ´Ólongµ½floatºÍ´Ólongµ½double¡££©
fµÄ³õʼֵ̫´óÁË£¬ÒÔÖÁÓÚÔÚ¶ÔÆä¼ÓÉÏ50£¬È»ºó½«½á¹ûתÐÍΪfloatʱ£¬Ëù²úÉúµÄÊýÖµµÈÓÚÖ±½Ó½«fת»»³ÉfloatµÄÊýÖµ¡£»»¾ä»°Ëµ£¬(float)2000000000 == 2000000050£¬Òò´Ë±í´ïʽf < START + 50¼´Ê¹ÊÇÔÚÑ»·ÌåµÚÒ»´ÎÖ´ÐÐ֮ǰ¾ÍÊÇfalse£¬ËùÒÔ£¬Ñ»·ÌåÒ²¾ÍÓÀÔ¶µÄ²»µ½»ú»áÈ¥ÔËÐС£
¶©ÕýÕâ¸ö³ÌÐò·Ç³£¼òµ¥£¬Ö»Ð轫ѻ·±äÁ¿µÄÀàÐÍ´ÓfloatÐÞ¸ÄΪint¼´¿É¡£ÕâÑù¾Í±ÜÃâÁËËùÓÐÓ븡µãÊý¼ÆËãÓйصIJ»¾«È·ÐÔ£º
for (int f = START; f < START + 50; f++)
count++;
Èç¹û²»Ê¹ÓüÆËã»ú£¬ÄãÈçºÎ²ÅÄÜÖªµÀ2,000,000,050Óë2,000,000,000ÓÐÏàͬµÄfloat±íʾÄØ£¿¹Ø¼üÊÇÒª¹Û²ìµ½2,000,000,000ÓÐ10¸öÒò×Ó¶¼ÊÇ2£ºËüÊÇÒ»¸ö2³ËÒÔ9¸ö10£¬¶øÿ¸ö10¶¼ÊÇ5×2¡£ÕâÒâζ×Å2,000,000,000µÄ¶þ½øÖƱíʾÊÇÒÔ10¸ö0½
Ïà¹ØÎĵµ£º
2008 Äê 6 ÔÂ 24 ÈÕ
ÔÎĵØÖ·£º http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
±¾ÎĽéÉÜ IBM FileNet P8 4.0 Platform ÌṩµÄ Content Java API¡£Ê×ÏÈ¶Ô FileNet P8 Content Engine ºÍ API ½øÐиÅÒª½éÉÜ, ²¢ËµÃ÷ÁËһЩ»ù±¾¸ÅÄËæºóÏêϸ½éÉÜÁË FileNet Content EngineÌṩµÄ»ùÓÚ EJB ......
ÏÂÃæµÄ³ÌÐò¶ÔÒ»¸ö±äÁ¿Öظ´µØ½øÐÐÔöÁ¿²Ù×÷£¬È»ºó´òÓ¡ËüµÄÖµ¡£ÄÇôÕâ¸öÖµÊÇʲôÄØ£¿
public class Increment {
public static void main(String[] args) {
int j = 0;
for (int i = 0; i < 100; i++)
j = j++;
System.out.println(j);
}
}
Õ§Ò»¿´£¬Õâ¸ö³ÌÐò¿ÉÄÜ» ......
×î½ü¹«Ë¾Åöµ½ÐèÒªÓÃͼ±íµÄÐÎʽÏÔʾһЩÊý¾Ý£¬ÎҾͿªÊ¼µ½ÍøÉϲéѯ£¬²éµ½ÁËjfreechartºÍamcharts,ÕâÁ½ÕßÎÒ¶¼ÊµÏÖ¹ýÁË£¬jfreechart×îºóÉú³ÉͼƬ£¬µ«ÊÇͼƬЧ¹û²»ÊÇÎÒÏëÒªµÄ£¬È»ºóÓÖÑо¿amcharts ËüµÄЧ¹ûȷʵºÜºÃ£¬¶øÇÒ¹Ù·½ÍøÕ¾ÉÏ»¹ÓкÃЩÀý×ӿɹ©ÏÂÔØ£¬ÍøÖ·ÊÇ:www.amcharts.com
£¨ÏëÒªÍê³ÉÒ»¸öamchartsͼÐÎÐèÒªswfobjects. ......