Android Hex String to Byte Array Convert hexStr2Str(String hexStr)

Here you can find the source of hexStr2Str(String hexStr)

Description

hex Str Str

License

Apache License

Declaration

public static String hexStr2Str(String hexStr) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String hexStr2Str(String hexStr) {
        String str = "0123456789ABCDEF";
        char[] hexs = hexStr.toCharArray();
        byte[] bytes = new byte[hexStr.length() / 2];
        int n;//from  w w  w.ja  va 2  s .  c  o  m

        for (int i = 0; i < bytes.length; i++) {
            n = str.indexOf(hexs[2 * i]) * 16;
            n += str.indexOf(hexs[2 * i + 1]);
            bytes[i] = (byte) (n & 0xff);
        }
        return new String(bytes);
    }
}

Related

  1. hexStringToBytes(String s)
  2. hex2bytes(String hex)
  3. hexStr2ByteArr(String paramString)
  4. hexStr2ByteArr(String str)
  5. hexStr2Bytes(String src)
  6. toByte(String hexString)
  7. toBytesFromHexString(String digits)
  8. hexStringToBytes(String s)
  9. hexStringToBytes(String s)