posts - 19, comments - 1, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          test code

          Posted on 2006-09-28 13:42 xyang 閱讀(224) 評論(0)  編輯  收藏
          ?1 public ? class ?hello? {
          ?2 ???? public ? static ? void ?main(String?a[])? throws ?java.io.IOException? {
          ?3 ????????String?tmp? = ? " 中文 " ;?
          ?4 ????????printHex(tmp, " Unicode " );
          ?5 ????????printHex(tmp, " GB2312 " );
          ?6 ????????printHex(tmp, " ISO8859-1 " );
          ?7 ????????printHex(tmp, " UTF-8 " );
          ?8 ????}

          ?9
          10 ???? private ? static ? void ?printHex(String?str,String?charset)? throws ?java.io.IOException? {
          11 ???????? byte []?buf? = ?str.getBytes(charset);
          12 ???????? for ?( int ?i? = ? 0 ;?i? < ?buf.length;?i ++ )? {
          13 ????????????System.out.print(Integer.toHexString(buf[i]));
          14 ????????????System.out.print( " ? " );
          15 ????????}

          16 ????????System.out.println( " ? " );
          17 ????}

          18
          19 }

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 安岳县| 东乌珠穆沁旗| 宜兰市| 永康市| 许昌县| 普兰店市| 迭部县| 乐安县| 贺州市| 黔南| 沭阳县| 芜湖市| 凤台县| 榆社县| 德兴市| 丰镇市| 望奎县| 兰坪| 镇原县| 南郑县| 老河口市| 宜宾市| 衡阳市| 庆安县| 皋兰县| 林州市| 保德县| 乌恰县| 蓬溪县| 齐齐哈尔市| 华亭县| 仙游县| 洱源县| 玉龙| 信丰县| 罗山县| 墨脱县| 吉林市| 浙江省| 安陆市| 海盐县|