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

JavaÊý×Öת×Ö·û´®Ç°Ãæ×Ô¶¯²¹0µÄʵÏÖ


±¾ÎÄÔ­Ö·£ºhttp://blogger.org.cn/blog/more.asp?name=hongrui&id=46926
/**  
 * JavaÀïÊý×Öת×Ö·û´®Ç°Ãæ×Ô¶¯²¹0µÄʵÏÖ¡£  
 *    
 */   
public class TestStringFormat {    
  public static void main(String[] args) {    
    int youNumber = 19;    
    // 0 ´ú±íÇ°Ãæ²¹³ä0    
    // 4 ´ú±í³¤¶ÈΪ4    
    // d ´ú±í²ÎÊýΪÕýÊýÐÍ    
    String str = String.format("%02d", youNumber);    
    System.out.println(str); // 01    
  }    
}   


Ïà¹ØÎĵµ£º

Java·þÎñ¶Ë½ÓÊÜget·½Ê½´«Ë͵ĺº×ÖתÂë·½·¨

1.ÓÃnew String(request.getParameter("name").getBytes("ISO-8859-1"),"GBK") ·½Ê½½øÐÐתÂë
2.ÉèÖÃtomcat£ºÔÚtomcatµÄconfĿ¼ÏÂÕÒµ½server.xmlÎļþ£¬ÔÚConnector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000" ......

Äêµ×ÊÕ²ØÏµÁÐ Java°²È«¹¤¾ß,Éú³ÉMD5,Base64,UUID


/*
* EncryptUtils.java
* Copyright (C) 2007-3-19 <JustinLei@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* ......

ÈÃÓû§²»±Ø°²×°JREÔËÐÐjava³ÌÐò

1¡¢½«ÏîÄ¿´ò°üºÃ£»
2¡¢½«JREĿѹËõ³ÉJRE.rar,·ÅÔÚµ±Ç°ÏîĿĿ¼Ï£»
2¡¢ÏÂÔØGreenJVM£¬ÆäÖÐÁ½¸öÖ÷ÒªÎļþ(GreenJVM.exeºÍvm.cfg)
3¡¢ÓüÆÊ±¾´ò¿ªvm.cfgÉèÖòÎÊý£¬²ÎÊýºÜ¶à£¬Ö»ÒªÉèÖÃÏÂÃæ¼¸¸ö¾Í¿ÉÒÔÓÃÁË£º
    SET_VM_NAME=jre.rar
    SET_START_JAR_PATH=***.jar   &nbs ......

javaÊý¾Ý¿âµÈ——ÂÒÂëÎÊÌâ½â¾ö°ì·¨

ÖÐÎÄÂÒÂë½â¾ö·½°¸£º
Êý¾Ý¿âÂÒÂë:
UTF-8¶ÔÖÐÎÄÓÃ3¸ö×Ö½ÚÀ´±íʾ
String s =”·ÉÏè”;
byte[] utf8 = s.getBytes(“utf-8”);//»ñµÃutf-8±àÂëµÄ×Ö½ÚÖµ
System….(new String(utf8,”gbk”);//ÓÃGBK±àÂë¸ñʽ¶ÔUTF-8±àÂë¸ñʽµÄ×Ö½ÚÊý×é½øÐнâÂ룬½«²úÉúÂÒÂë¡£
 
²é¿´Êý¾Ý¿âµÄ× ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ