javaºº×Ö×Ö·û´®°´Æ´ÒôÅÅÐò
Ä¿±ê£ºÊµÏÖÒ»¸öºº×Ö×Ö·û´®°´ººÓïÆ´Òô×Öµä˳ÐòÅÅÐò¡£
ÔÀí£ºÔÚwindows»·¾³µÄgbk×Ö·û¼¯Àºº×ÖÊÇ°´ººÓïÆ´Òô×Öµä˳Ðò±àÂëµÄ£¬Èç“´¡”ÊÇB4A1£¬“´¢”ÊÇB4A2¡£ÕâÀïÓиöÎÊÌâ¾ÍÏñÉÏÃæµÄ´¢ºÍ´¡ÕâÑùµÄͬÒô×ÖÖ»ÄÜ×ñÕÕ±àÂëµÄ˳ÐòÁË£¬ÁíÍâ¶àÒô×ÖÒ²µÃ×ñÕÕ±àÂë˳Ðò¡£Éè¼Æ˼·ÊÇÏȲð·Öºº×Ö×Ö·û´®Îª×Ö·ûÊý×飬»ñµÃÿ¸öºº×Ö×Ö·ûµÄ16½øÖÆ×Ö·û´®±íʾ£¬È»ºó±È½Ï¸Ã×Ö·û´®µÄ×Öµä˳Ðò´óС£¬ÅÅÐò¡£ÐèҪ˵Ã÷µÄÊÇ£¬»ñµÃºº×Ö×Ö·ûµÄ×Ö½ÚÊý×飬ת»»³Éint±È½ÏÒ²¿É£¬ÊµÏÖ´ÓÂÔ¡£ÏÂÃæÊÇʵÏֵĴúÂë:
import java.io.UnsupportedEncodingException;
public class HanZiSort {
public static void main(String[] args) throws UnsupportedEncodingException {
String test = "ÎÒ°®±±¾©Ìì°²ÃÅ";
System.out.println(sort(test, "gb2312"));
}
public static String sort(String s, String charset) {
char[] c = s.toCharArray();
for (int i = 0; i < c.length - 1; i++) {
for (int j = i + 1; j < c.length; j++) {
if (getHexString(new String(new char[] { c[i] }), charset)
.compareTo(
getHexString(new String(new char[] { c[j] }),
charset)) > 0) {
char temp = c[i];
c[i] = c[j];
c[j] = temp;
}
}
}
return new String(c);
}
public static String getHexString(String s, String charset) {
byte[] b = null;
StringBuffer sb = new StringBuffer();
try {
b = s.getBytes(charset);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
for (int i = 0; i < b.length; i++) {
sb.append(Integer.toHexString(b[i] & 0xFF));
}
return sb.toString();
}
}
´òÓ¡µÄ½á¹ûΪ£º°®°²±±¾©ÃÅÌìÎÒ
Ïà¹ØÎĵµ£º
Tiger ÖеÄÒ»¸öÖØÒªÐÂÌØÐÔÊÇö¾Ù¹¹Ô죬ËüÊÇÒ»ÖÖеÄÀàÐÍ£¬ÔÊÐíÓó£Á¿À´±íʾÌض¨µÄÊý¾Ý Ƭ¶Ï£¬¶øÇÒÈ«²¿¶¼ÒÔÀàÐÍ°²È«µÄÐÎʽÀ´±íʾ¡£Tiger ר¼Ò¡¢developerWorks µÄ¶à²ú×÷Õß Brett McLaughlin½«½âÊÍö¾ÙµÄ¶¨Ò壬½éÉÜÈçºÎÔÚÓ¦ÓóÌÐòÖÐÔËÓÃö¾Ù£¬ÒÔ¼°ËüΪʲôÄܹ»ÈÃÄúÅ×ÆúËùÓоɵÄ
public static final ´úÂë¡£
¡¡ ÄúÒѾ ......
1. ÔĶÁÏÂÁдúÂë»Ø´ðÎÊÌ⣨µÚÒ»¸öJava³ÌÐò£¬Àí½âPATHºÍCLASSPATH£¬Ñ§»áʹÓÃjavacºÍjavaÃüÁ
view plaincopy to clipboardprint?
package cn.edu.uibe;
public class HelloWorld {
public static void main(String[] args) {
&nb ......
ת×Ô£ºhttp://student.csdn.net/space.php?uid=52781&do=blog&id=15267&cid=50252
javaÖÐʹÓÃÕýÔò±í´ïʽ
¼ÆËã»úרҵ±ÏÒµ»òÕßʹÓùýUnix¡¢PerlµÈ²úÆ·µÄ¶ÁÕßÒ»¶¨¶ÔÕýÔò±í´ïʽÓÐÒ»¶¨µÄÓ¡Ïó,¼´Ê¹Ã»ÓнӴ¥¹ýÕýÔò±í´ïʽҲ²»Òª±»ËüµÄÍâòËùÏŵ¹¡£ËäÈ»×öµ½¾«Í¨ÕýÔò±í´ïʽ±È½ÏÄÑ£¬µ«ÊÇÄܹ»ÕÆÎÕËüµÄ»ù±¾Ó¦ÓÃÈ´ÊÇ· ......
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundExce ......
J2ME£¬ÏÖ³ÆΪJava ME(Java Platform, Micro Edition )ÊÇΪ»ú¶¥ºÐ¡¢Òƶ¯µç»°ºÍPDAÖ®ÀàǶÈëʽÏû·Ñµç×ÓÉ豸ÌṩµÄJavaÓïÑÔƽ̨£¬°üÀ¨ÐéÄâ»úºÍһϵÁбê×¼»¯µÄJava API¡£ËüºÍJava SE¡¢Java EEÒ»Æð¹¹³ÉJava¼¼ÊõµÄÈý´ó°æ±¾£¬²¢ÇÒͬÑùÊÇͨ¹ýJCP£¨Java Community Process£©Öƶ©µÄ¡£
Ä¿Ç°½×¶Î£¬Java ME×îÁ÷ÐеÄÓ¦ÓÃÊÇÓÎÏ·Èí¼þ¡£ÒòÎ ......