<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 104,  comments - 34,  trackbacks - 0

    package demo;

    import java.io.File;  
    import java.io.FileWriter;  
    import java.io.IOException;  
    import java.io.PrintWriter;  
     
    /** 
     * @date 2009-3-11 
     * @author Xing,Xiudong 
     * @Email:xingxiuodng[at]gmail.com 
     * @index:http://blog.csdn.net/xxd851116 
     */ 
    public class CoderUtils {  
     
        public static char ascii2Char(int ASCII) {  
            return (char) ASCII;  
        }  
     
        public static int char2ASCII(char c) {  
            return (int) c;  
        }  
     
        public static String ascii2String(int[] ASCIIs) {  
            StringBuffer sb = new StringBuffer();  
            for (int i = 0; i < ASCIIs.length; i++) {  
                sb.append((char) ascii2Char(ASCIIs[i]));  
            }  
            return sb.toString();  
        }  
     
        public static String ascii2String(String ASCIIs) {  
            String[] ASCIIss = ASCIIs.split(",");  
            StringBuffer sb = new StringBuffer();  
            for (int i = 0; i < ASCIIss.length; i++) {  
                sb.append((char) ascii2Char(Integer.parseInt(ASCIIss[i])));  
            }  
            return sb.toString();  
        }  
     
        public static int[] string2ASCII(String s) {// 字符串轉換為ASCII碼  
            if (s == null || "".equals(s)) {  
                return null;  
            }  
     
            char[] chars = s.toCharArray();  
            int[] asciiArray = new int[chars.length];  
     
            for (int i = 0; i < chars.length; i++) {  
                asciiArray[i] = char2ASCII(chars[i]);  
            }  
            return asciiArray;  
        }  
     
        public static String getIntArrayString(int[] intArray) {  
            return getIntArrayString(intArray, ",");  
        }  
     
        public static String getIntArrayString(int[] intArray, String delimiter) {  
            StringBuffer sb = new StringBuffer();  
            for (int i = 0; i < intArray.length; i++) {  
                sb.append(intArray[i]).append(delimiter);  
            }  
            return sb.toString();  
        }  
     
        public static String getASCII(int begin, int end) {  
            StringBuffer sb = new StringBuffer();  
            for (int i = begin; i < end; i++) {  
                sb.append(i).append(":").append((char) i).append("\t");  
                // sb.append((char) i).append("\t");  
                if (i % 10 == 0) {  
                    sb.append("\n");  
                }  
            }  
            return sb.toString();  
        }  
     
        public static String getCHASCII(int begin, int end) {  
            return getASCII(19968, 40869);  
        }  
     
        public static void showASCII(int begin, int end) {  
            for (int i = begin; i < end; i++) {  
                // System.out.print(i + ":" + (char) i + "\t");  
                System.out.print((char) i + "\t");  
                if (i % 10 == 0) {  
                    System.out.println();  
                }  
            }  
        }  
     
        public static void showCHASCII() {  
            showASCII(19968, 40869);  
        }  
     
        public static void showIntArray(int[] intArray) {  
            showIntArray(intArray, ",");  
        }  
     
        public static void showIntArray(int[] intArray, String delimiter) {  
            for (int i = 0; i < intArray.length; i++) {  
                System.out.print(intArray[i] + delimiter);  
            }  
        }  
     
        public static void createFile(String filePathAndName, String fileContent)  
                throws IOException {  
     
            String filePath = filePathAndName;  
            filePath = filePath.toString();  
            File myFilePath = new File(filePath);  
            if (!myFilePath.exists()) {  
                myFilePath.createNewFile();  
            }  
            FileWriter resultFile = new FileWriter(myFilePath);  
            PrintWriter myFile = new PrintWriter(resultFile);  
            String strContent = fileContent;  
            myFile.println(strContent);  
            myFile.close();  
            resultFile.close();  
        }  
     
        public static void main(String[] args) throws IOException {  
     
            String s = "好好學習!天天向上!————笑的自然 2009年3月11日";  
            showIntArray(string2ASCII(s), " ");  
            System.out.println();  
            System.out.println(ascii2String(string2ASCII(s)));  
            createFile("c:\\console_ch.txt", getCHASCII(0, 50000));  
        }  
     

    posted on 2010-08-06 17:59 末日風情 閱讀(5709) 評論(0)  編輯  收藏 所屬分類: java編程
    <2010年8月>
    25262728293031
    1234567
    891011121314
    15161718192021
    22232425262728
    2930311234

    常用鏈接

    留言簿(4)

    隨筆分類

    隨筆檔案

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲一级免费视频| 全免费a级毛片免费看| 成年人在线免费看视频| 亚洲成aⅴ人在线观看| 特级无码毛片免费视频尤物| 久久精品亚洲日本佐佐木明希| 最近中文字幕大全免费版在线| 亚洲午夜久久久影院伊人| 在线免费观看伊人三级电影| 亚洲视频精品在线| 久久受www免费人成_看片中文| 亚洲高清中文字幕免费| 国产精品国产午夜免费福利看 | 国产免费AV片无码永久免费| 在线观看日本亚洲一区| 国产一区二区视频免费| 免费的黄色网页在线免费观看| 亚洲伊人久久成综合人影院| baoyu777永久免费视频| 亚洲国产美国国产综合一区二区 | 亚洲中久无码不卡永久在线观看| 四虎影视久久久免费观看| 亚洲精品乱码久久久久久中文字幕 | 亚洲国产成人五月综合网| 巨胸喷奶水视频www免费视频| 国产精品亚洲A∨天堂不卡| 无码国产精品一区二区免费| 亚洲欧美日韩综合俺去了| 亚洲日本韩国在线| 18禁成人网站免费观看| 亚洲国产精品成人AV在线| 综合亚洲伊人午夜网| 久久久久久免费视频| 永久免费无码网站在线观看个| 亚洲AV无码不卡在线播放| 久久久久国产精品免费免费搜索| 色妞www精品视频免费看| 亚洲va国产va天堂va久久| 四虎成人免费观看在线网址 | 免费国产真实迷j在线观看| 国产羞羞的视频在线观看免费|