16進制字符串轉換成中文方法.  

          2006-12-28 13:25:49|  分類: Java編程|字號 訂閱

          現知道一個16進制的字符串,比如:"6162B4F36364BCD2657CBAC366",哪位高手能給一個將這個字符串轉換成中文的方法啊,我到百度上搜了半天也沒搜到,即使有也不是java方法。哪位高人能抽出寶貴的時間幫忙解決一下啊,萬分感激!!!轉換出來應該是六個字母,3個中文,還有一個符號,希望高手們把謎底揭開,關鍵是寫出實現方法,謝謝了!!!!!!!!!!!!!!!!!!!!!!

           

          回復求教!!哪位高手能將6162B4F36364BCD2657CBAC366轉換成中文! 
           ymy7100   短消息   
          回復主題求教!!哪位高手能將6162B4F36364BCD2657CBAC366轉換成中文!

          2006-12-21 下午1:14  

          回復 1 of 4

          回復

          暈!
          沒有高手嗎?
          是因別的公司開發的delphi程序要調用我們的java程序,其中java中要寫個函數,實現將他們傳來的數據顯示出來并存到數據庫,哪位大蝦伸出援手啊!!!!!!

           

          回復求教!!哪位高手能將6162B4F36364BCD2657CBAC366轉換成中文! [得分:50] 
           rehte   短消息   
          回復主題求教!!哪位高手能將6162B4F36364BCD2657CBAC366轉換成中文!

          2006-12-21 下午2:42  

          回復 2 of 4

          回復

          暈,幫幫你
          應該是:abcde|f
          首先要知道編碼,中國漢字一般使用GBK或者gb2312gb2312GBK的子集,因此安全起見使用GBK一般就行了:

          public class Decoder {
          public static void main(String[]args){
          String result=decodeString(args[0], "GBK");
          System.out.println(result);

          private static String decodeString(String string, String encoding) {
          try {
          byte[]data=string2Bytes(string);
          return new String(data, encoding);
          } catch (UnsupportedEncodingException ex) {
          ex.printStackTrace();
          return null;
          }

          private static byte[] string2Bytes(String string) {
          int blen=string.length()/2;
          byte[]data=new byte[blen];
          for(int i=0;i<blen;i++){
          String bStr=string.substring(2*i,2*(i+1));
          data[i]=(byte)Integer.parseInt(bStr,16);
          }
          return data;
          }
          }

          運行:
          java Decoder 6162B4F36364BCD2657CBAC366

          posted @ 2013-05-12 14:46 勒緊皮帶向前沖 閱讀(299) | 評論 (0)編輯 收藏
           
               摘要: JAVA 取得當前目錄的路徑(轉)及PS  閱讀全文
          posted @ 2012-03-26 09:34 勒緊皮帶向前沖 閱讀(436) | 評論 (0)編輯 收藏
           
               摘要: flash builder 4文本模板與代碼注釋(轉)  閱讀全文
          posted @ 2011-12-26 14:56 勒緊皮帶向前沖 閱讀(1658) | 評論 (0)編輯 收藏
           
               摘要: win7在64位下PL/SQL Developer連接遠程oracle數據庫(轉+補充)  閱讀全文
          posted @ 2011-12-21 10:59 勒緊皮帶向前沖 閱讀(1893) | 評論 (0)編輯 收藏
           
          只要把 data grid column 的 showDataTips 屬性設置為 true ,然后把 column 的 dataTipField 設置一個值就行了 @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
          posted @ 2011-12-13 09:04 勒緊皮帶向前沖 閱讀(453) | 評論 (0)編輯 收藏
           
               摘要: 這個1個使用flex4 的List 組件的例子  閱讀全文
          posted @ 2011-12-03 10:14 勒緊皮帶向前沖 閱讀(1929) | 評論 (0)編輯 收藏
           
          @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
          //驗證并更新此對象的屬性和布局
          Tree.validateNow();
          for each (var item:Object in Tree.dataProvider)
          {
          //打開或關閉指定項目下的所有樹項目。如果設置 dataProvider 之后立即調用 expandChildrenOf(),則您可能看不到正確的行為。您應該等待對組件進行驗證或調用 validateNow() 方法。
          Tree.expandChildrenOf(item, true);}

          第二種方式


           1
           <?xml version="1.0" encoding="utf-8"?>
           2 <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           3                xmlns:s="library://ns.adobe.com/flex/spark" 
           4                xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
           5                creationComplete="onInit()">
           6     <fx:Declarations>
           7         <!-- 將非可視元素(例如服務、值對象)放在此處 -->
           8         
           9         <fx:XML id="xml" xmlns="">
          10             <node id="#" label="所有">
          11                 <node id="101" label="Name101">
          12                     <node id="10101" label="Name10101"/>
          13                     <node id="10102" label="Name10102"/>
          14                     <node id="10103" label="Name10103"/>
          15                 </node>
          16                 <node id="102" label="Name102">
          17                     <node id="10201" label="Name10201"/>
          18                     <node id="10202" label="Name10202"/>
          19                 </node>
          20                 <node id="103" label="Name103">
          21                     <node id="10301" label="Name10301"/>
          22                 </node>
          23             </node>
          24         </fx:XML>
          25     </fx:Declarations>
          26     
          27     <fx:Script>
          28         <![CDATA[
          29             private function onInit():void{
          30                 tree.selectedIndex=0;
          31                 tree.callLater(expand,null);
          32             }
          33             private function expand():void{
          34                 tree.expandItem(tree.selectedItem,true);
          35                 //這里可以隨便指定展開的節點,如果超出默認展開最后一個根節點
          36                 tree.selectedIndex=1;
          37                 tree.expandItem(tree.selectedItem,true);
          38             }
          39         ]]>
          40     </fx:Script>
          41     <mx:Tree id="tree" x="73" y="36" width="200" height="217" dataProvider="{xml}" labelField="@label"></mx:Tree>
          42 </s:Application>
          43 



          posted @ 2011-11-27 10:27 勒緊皮帶向前沖 閱讀(2636) | 評論 (1)編輯 收藏
           
               摘要: flex4 在瀏覽器重打開網址  閱讀全文
          posted @ 2011-11-14 11:47 勒緊皮帶向前沖 閱讀(407) | 評論 (0)編輯 收藏
           
               摘要: itemCreationPolicy 設定State組件立即創建  閱讀全文
          posted @ 2011-11-14 09:22 勒緊皮帶向前沖 閱讀(615) | 評論 (0)編輯 收藏
           
               摘要: StringGrid使用全書
            閱讀全文
          posted @ 2011-01-13 11:16 勒緊皮帶向前沖 閱讀(323) | 評論 (0)編輯 收藏
          僅列出標題
          共14頁: 1 2 3 4 5 6 7 8 9 下一頁 Last 
           
          主站蜘蛛池模板: 广灵县| 青州市| 商丘市| 黔江区| 长垣县| 滦南县| 绥宁县| 同仁县| 清徐县| 任丘市| 阿拉善左旗| 信宜市| 合江县| 长武县| 芦山县| 内乡县| 榆树市| 额敏县| 通城县| 商河县| 正阳县| 乌兰察布市| 涡阳县| 和政县| 东明县| 娄烦县| 当涂县| 白河县| 南丰县| 永川市| 家居| 安图县| 剑阁县| 东乌珠穆沁旗| 石阡县| 肃北| 平山县| 额尔古纳市| 丽水市| 高邑县| 嘉黎县|