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

          test code

          Posted on 2006-09-28 13:42 xyang 閱讀(218) 評論(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 }

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


          網站導航:
           
          主站蜘蛛池模板: 会昌县| 家居| 镇沅| 佛坪县| 巧家县| 长春市| 孙吴县| 惠安县| 新建县| 太原市| 九台市| 青海省| 江孜县| 桂东县| 明水县| 时尚| 重庆市| 和田市| 奉新县| 新竹市| 光泽县| 沙田区| 开鲁县| 三亚市| 阜康市| 丰县| 柳江县| 两当县| 莱西市| 台山市| 普定县| 宝鸡市| 宾川县| 灵台县| 银川市| 镇坪县| 锦屏县| 定陶县| 嘉善县| 墨江| 黑水县|