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

JavaÖÐÇó100µÄ½×³Ë

 Ê¹ÓÃBigInteger´óÈÝÁ¿ÔËËãÀà¼ÆËã100µÄ½×³Ë
Ò».Ò»°ãËã·¨(Ñ­»·)
public class Test {
public static void main(String[] args) {
int result = 1;
for (int i = 1; i <= 100; i++) {
result *= i;
}
System.out.println(result);
}
}
Êä³ö½á¹ûΪ0£¬ÒòΪintÎÞ·¨±£´æÏÂ100µÄ½×³ËµÄ½á¹û£¬100µÄ½×³ËµÄ³¤¶ÈÖÁÉÙ´óÓÚ50룬ҲҪ´óÓÚlong,double
¶þ.ʹÓÃBigInteger´óÈÝÁ¿ÔËËãÀà
import java.math.BigInteger;
public class Test {
public static void main(String[] args) {
BigInteger result = new BigInteger("1");//Ϊresult¸³³õʼֵ£¬Îª1
for (int i = 1; i <= 100; i++) {
BigInteger num = new BigInteger(String.valueOf(i));
result = result.multiply(num);//µ÷ÓÃ×Գ˷½·¨
}
System.out.println(result);//Êä³ö½á¹û
System.out.println(String.valueOf(result).length());//Êä³ö³¤¶È
}
}
¼ÆËã½á¹ûΪ£º93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
²ú¶È:158


Ïà¹ØÎĵµ£º

Java ×Ö·û´®µÄ ´¦Àí

 public class StringUtil
{
public static String convertToStringWithTrim(Object object)
{
if(null == object)
{
return null;
}

String returnStr = (String)object;

return Trim(returnStr);
}
public static String Trim(String str)
{
if(IsEmpty(str))
{
r ......

Java/JspÅäÖÃ

JAVAÅäÖãº
1£º JAVA_HOME £º  C:\Program Files\Java\jdk1.6.0_12
2£ºCLASSPATH £º    .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
3£ºPATH £º              %JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
TomcatÅäÖ ......

JavaÊý¾Ý¿â°üjava.sql.*Ïê½â(jdk1.6)

1:Ó¦ÓóÌÐò²»ÔÙÐèҪʹÓà Class.forName() ÏÔʽµØ¼ÓÔØ JDBC Çý¶¯³ÌÐò¡£µ±Ç°Ê¹Óà Class.forName() ¼ÓÔØ JDBC Çý¶¯³ÌÐòµÄÏÖÓгÌÐò½«ÔÚ²»×÷Ð޸ĵÄÇé¿öϼÌÐø¹¤×÷¡£
2:ÐèҪעÒâÒÔÏÂÃüÁ
executeUpdate£ºÊÇ×î»ù´¡µÄÊý¾Ý¿âµÄ¸üС¢²åÈëºÍɾ³ý²Ù×÷¡£Ð§ÂʵÍÏ¡£   
executeQuery£ºÊÇ×î»ù´¡µÄÖ´ÐвéѯÓï¾ä£¬Í¬Ñù ......

JavaÖеÄ×Ö·û¼¯±àÂëÈëÃÅ 2

 
¡¡¡¡Ëµµ½GB2312ºÍGBK¾Í²»µÃ²»ÌáÖÐÎÄÍøÒ³µÄ±àÂë¡£¾¡¹ÜºÜ¶àпª·¢µÄWebϵͳºÍÐÂÉÏÏßµÄ×¢Öعú¼Ê»¯µÄÍøÕ¾¶¼¿ªÊ¼Ê¹ÓÃUTF-8£¬ÈÔÓÐÏ൱һ²¿·ÖµÄÖÐÎÄýÌå¼á³ÖʹÓÃGB2312ºÍGBK£¬ÀýÈçÐÂÀ˵ÄÒ³Ãæ¡£ÆäÖÐÓÐÁ½µãºÜÖµµÃ×¢Òâ¡£
¡¡¡¡µÚÒ»£¬Ò³ÃæÖÐmeta±êÇ©µÄ²¿·Ö£¬³£³£¿ÉÒÔ¼ûµ½charset=GB2312ÕâÑùµÄд·¨£¬ºÜ²»ÐÒµÄÊÇ£¬Õâ¸ö“cha ......

javaËæ»úÈ¡listÖв»Öظ´µÄÔªËØ

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.huadoo.model.Area;
public class Aaaa {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ