zoukankan      html  css  js  c++  java
  • 16进制到十进制转换问题

    进制转换问题:

    /**
     * 16进制转ASCII
     *
     * @param hex
     * @return
     */
    public static String hex2Str(String hex) {
        StringBuilder sb = new StringBuilder();
        StringBuilder temp = new StringBuilder();
        //49204c6f7665204a617661 split into two characters 49, 20, 4c...
        for (int i = 0; i < hex.length() - 1; i += 2) {
            //grab the hex in pairs
            String output = hex.substring(i, (i + 2));
            //convert hex to decimal
            int decimal = Integer.parseInt(output, 16);
            //convert the decimal to character
            sb.append((char) decimal);
            temp.append(decimal);
        }
        return sb.toString();
    
                    // https://blog.csdn.net/zfpigpig/article/details/8186470
    // https://blog.csdn.net/zhp694125196/article/details/72824400
    // EPCID = EPCID.replace((char) 12288, ' ');
    // or
    // EPCID = EPCID.replaceAll((char) 12288 + "", "");// epcList.add(EPCID.trim());无效
    epcList.add(EPCID.trim());
    L.i(" No..." + No + " EPCID... " + EPCID + " Count..." + Count);




  • 相关阅读:
    P2622 关灯问题II(关灯问题)
    P1140 相似基因
    Choose and Divide UVa 10375
    Disgruntled Judge UVA
    Color Length UVA
    P1052 过河
    P1026 统计单词个数
    Balanced Number HDU
    The SetStack Computer UVA
    Urban Elevations UVA
  • 原文地址:https://www.cnblogs.com/jooy/p/9385651.html
Copyright © 2011-2022 走看看