java Á½¸öʱ¼ä¶ÎÓжàÉÙÌì
public static void main(String args[]){
Date calr1=new Date(2010, 3,1);
Date calr2=new Date(2010,3,31);
Long n=calr2.getTime()-calr1.getTime();
int a=(int)(n/(1000*60*60*24));
System.out.println("Á½ÕßÏà²î:"+a+"Ìì");
}
Ïà¹ØÎĵµ£º
Ò»¡¢Í¨¹ýHttpClient(apache commons-httpclient)·½Ê½£¬»ñÐíÍøÒ³ÄÚÈÝ£¬²¢½âÎö³öÐèÒªµÄ¶«Î÷¡£
ÕâÖÖ·½·¨Ïà¶Ô±È½Ï¼òµ¥£¬ÒòΪcommons-httpclientÒѾ×öÁ˺ܺõķâ×°£¬¼òµ¥µÄ´úÂëÈçÏ£º
// ¹¹ÔìHttpClientµÄʵÀý
HttpClient httpClient = new HttpClient();
HttpClientParams clientPar ......
Flyweight ¶¨Òå:
±ÜÃâ´óÁ¿ÓµÓÐÏàͬÄÚÈݵÄСÀàµÄ¿ªÏú(ÈçºÄ·ÑÄÚ´æ),ʹ´ó¼Ò¹²ÏíÒ»¸öÀà(ÔªÀà).
ÃæÏò¶ÔÏóÓïÑÔµÄÔÔò¾ÍÊÇÒ»Çж¼ÊǶÔÏó,µ«ÊÇÈç¹ûÕæÕýʹÓÃÆðÀ´,ÓÐʱ¶ÔÏóÊý¿ÉÄÜÏԵúÜÅÓ
´ó,±ÈÈç,×Ö´¦ÀíÈí¼þ,Èç¹ûÒÔÿ¸öÎÄ×Ö¶¼×÷Ϊһ¸ö¶ÔÏó,¼¸Ç§¸ö×Ö,¶ÔÏóÊý¾ÍÊǼ¸Ç§,ÎÞÒɺÄ
·ÑÄÚ´æ,ÄÇôÎÒÃÇ»¹ÊÇÒª"Çóͬ´æÒì",ÕÒ³öÕâЩ¶ÔÏóȺµÄ¹²Í¬ ......
String newStr = new String(oldStr.getBytes(), "UTF-8");
javaÖеÄStringÀàÊÇ°´ÕÕunicode½øÐбàÂëµÄ£¬µ±Ê¹ÓÃString(byte[] bytes, String encoding)¹¹Ôì×Ö·û´®Ê±£¬encodingËùÖ¸µÄÊÇbytesÖеÄÊý¾ÝÊÇ°´ÕÕÄÇÖÖ·½Ê½±àÂëµÄ£¬¶ø²»ÊÇ×îºó²úÉúµÄStringÊÇʲô±àÂ뷽ʽ£¬»»¾ä»°Ëµ£¬ÊÇÈÃϵͳ°ÑbytesÖеÄÊý¾ÝÓÉencoding±à ......
package tao.hai.bing;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class LoadJar {
public static void main(String[] args)
{
Syst ......
¹ØÓÚJavaÉú³É±³¾°Í¸Ã÷µÄpngͼƬ
×î½üÓõ½Java¶¯Ì¬Éú³É±³¾°Í¸Ã÷µÄͼƬ¹¦ÄÜ£¬´ÓgifºÍpngÖÐÑ¡ÔñÁËpng¸ñʽ£¬¸öÖÐÔµÓɾͲ»ËµÁË£¬ÓÚÊǶ¯ÊÖµ½ÍøÉÏËÑË÷ÓÐÓõĴúÂë¡£ÏÖ°ÑËÑË÷½á¹û×ܽáÈçÏ£º
1. Éú³ÉpngͼƬ
int width = 400;
int height = 300;
// ´´½¨BufferedImage¶ÔÏó
BufferedImage&nb ......