讀取的檔案為UTF-8編碼

        BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(outputPath),"UTF-8"));
        StringBuffer sb = new StringBuffer();
        String tmp = "";
        while ((tmp= br.readLine())!=null){
            sb.append(tmp);
            }
       
         for (int i = 0; i < sb.length(); ++i){
              System.out.println("第"+i+"個字:"+sb.charAt(i));
              System.out.println("十六進位    >>>    " + Integer.toHexString(sb.charAt(i)));
              System.out.println("八進位        >>>    " + Integer.toOctalString(sb.charAt(i)));
              System.out.println("二進位        >>>    " + Integer.toBinaryString(sb.charAt(i)));
          }

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 sunspirit 的頭像
    sunspirit

    Step by Step

    sunspirit 發表在 痞客邦 留言(0) 人氣()