½ØÈ¡×Ö·û´®(ÖÐÓ¢»ìºÏ´®) JAVA´úÂë
public class SplitString {
/**
* @param args
*/
public static void main(String[] args) {
String str = "ÖÐZellÖйú5000Äê,Congruations!";
int bytes = 8;
str = new SplitString().getSubString(str, bytes);
System.out.println(str);
}
public String getSubString(String str,int bytes){
int temp = bytes;
byte [] AllBytes = str.getBytes();
int AllStrByteLen = AllBytes.length;
if(bytes > AllStrByteLen | bytes <= 0){
return str;
}
int ChinaWordsNum = 0;
for(int i=0;i<temp;i++){
int IntOfByte = (int)AllBytes[i];
if(IntOfByte < 0 ){
ChinaWordsNum+=1;
}
}
if(ChinaWordsNum%2 == 0){
return new String(AllBytes,0,temp);
}else{
if(bytes == 1){
return null;
}
&
Ïà¹ØÎĵµ£º
1.JavaÀïÃæÊ¹ÓÃ
static
·½·¨ÓÐʲôºÃ´¦£¿
´ð£ºÔÚÏîÄ¿ÖУ¬¶ÔÓÚÆµ·±Ê¹Óõķ½·¨£¬Ê¹ÓÃstatic
ÐÞÊλáÌá¸ßЧÂÊÂð£¿
¾²Ì¬·½·¨µÄºÃ´¦¾ÍÊDz»ÓÃÉú³ÉÀàµÄʵÀý¾ÍÄÜÖ±½Óµ÷ÓúͶÔÏóÎÞ¹Ø
Äã²»ÓÃÉú³É¶ÔÏó¾ÍÄÜÓÃÕâ¸ö·½·¨ÁË£¬²»ÊÇÌá¸ßЧÂÊ£¿ÄãÉú³É¶ÔÏóµÃÕ¼ÓÃÄÚ´æ¿Õ¼ä°¡
ÖÁÓÚ¾²Ì¬ÊôÐÔÒ²ÄÜÌá¸ßЧÂÊ£¬ÄãÆÕͨµÄÊôÐÔÿ¸öÀà¶Ô ......
FlexÔÚºÍjavaµ÷Óùý³ÌÖУ¬ÆäʵÓиü¼ÓÁé»îµÄ°ì·¨À´Ìá¸ßϵͳµÄÃô½Ý¶È£¬¼«´óÌá¸ßϵͳµÄñîºÏºÍ¿ª·¢Ð§ÂÊ¡£ÔÚÕâÀïÎÒ¼ÌÐø¸ø´ó¼Ò½éÉÜһϣ¬Ãô½Ýµ÷ÓÃÖеÄjava¶¯Ì¬´úÂëµ÷Óá£
ÏÈ¿´javaµÄÀà(BeanShell)ÕâÀïÖ÷ÒªÊǽÓÊÕjava´úÂëÀ´¶¯Ì¬µ÷ÓõÄ
package com.shine.framework.be ......
¡¡¡¡¾Ý¹úÍâýÌ屨µÀ£¬MozillaÒѾÕë¶ÔFirefoxÉèÖÃÁËÒ»¸ö¶ñÒâJava²å¼þÆÁ±ÎºÚÃûµ¥¡£
¡¡¡¡¾Ý°²È«²©¿ÍBrian Krebs½éÉÜ£¬ÉÏÖܼ׹ÇÎĹ«Ë¾·¢²¼ÁËÒ»¸öÐÞ¸´Java²å¼þ©¶´µÄ¸üУ¬µ«ÊÇMozilla¿ª·¢ÈËÔ±·¢ÏÖ£¬Õâ¸ö¸üÐÂûÓÐɾ³ý¾É°æ±¾µÄ´úÂ룬ʹµÃϵͳÈÔÈ»ÁôÏÂÁË©¶´´úÂ룬´Ó¶øÊ¹µÃÒÅÁô´úÂë³ÉΪеĩ¶´¡£¶Ô´Ë£¬Mozilla²»µÃ²»½«ÆÁ± ......
ÓÃCµÄÈËÒ»¶¨ÖªµÀ__FILE__ºÍ__LINE__,µ«ÊÇJavaÖÐ ²¢Ã»ÓÐÕâÑùµÄ¶¨Ò壬ÓÐʱºòµ÷ÊÔ¶àÏ߳̾ͺܲ»·½±ã£¬Ã»°ì·¨£¬×Ô¼º¶¯ÊÖ£¬·áÒÂ×ãʳ~ÓÃÏÂÃæµÄº¯ÊýÈ¡µÃµ±Ç°Ðкš£
º¯Êý£º
/**
*µÃµ½ExceptionËùÔÚ´úÂëµÄÐÐÊý
*Èç¹ûûÓÐÐÐÐÅÏ¢,·µ»Ø-1
*/
public static int getLineNumber(Exception e){
StackTraceElement[] trace =e.getStac ......
¹ØÓÚvolatile
ÎÒÃÇÖªµÀ£¬ÔÚJavaÖÐÉèÖñäÁ¿ÖµµÄ²Ù×÷£¬³ýÁËlongºÍdoubleÀàÐ͵ıäÁ¿Íâ¶¼ÊÇÔ×Ó²Ù×÷£¬Ò²¾ÍÊÇ˵£¬¶ÔÓÚ±äÁ¿ÖµµÄ¼òµ¥¶Áд²Ù×÷ûÓбØÒª½øÐÐͬ²½¡£
ÕâÔÚJVM 1.2֮ǰ£¬JavaµÄÄÚ´æÄ£ÐÍʵÏÖ×ÜÊÇ´ÓÖ÷´æ¶ÁÈ¡±äÁ¿£¬ÊDz»ÐèÒª½øÐÐÌØ±ðµÄ×¢ÒâµÄ¡£¶øËæ×ÅJVMµÄ³ÉÊìºÍÓÅ»¯£¬ÏÖÔÚÔÚ¶àÏ̻߳·¾³ÏÂ
volatile¹Ø¼ü×ÖµÄʹÓñäµÃ·Ç³£ÖØ ......