Android Hex String to Byte Array Convert hex2bytes(String hex)

Here you can find the source of hex2bytes(String hex)

Description

hexbytes

Declaration

public static byte[] hex2bytes(String hex) 

Method Source Code

//package com.java2s;

public class Main {

    public static byte[] hex2bytes(String hex) {
        byte[] bytes = new byte[hex.length() / 2];
        for (int i = 0; i < bytes.length; i++) {
            bytes[i] = (byte) Integer.parseInt(
                    hex.substring(i * 2, (i + 1) * 2), 16);
        }//  w ww.  j a  va2s.c  o m
        return bytes;
    }
}

Related

  1. hexToByte(String input)
  2. hexToBytes(String hexString)
  3. hexToByte(char char1, char char2)
  4. hexStringToByteArray(String s)
  5. hexStringToBytes(String s)
  6. hexStr2ByteArr(String paramString)
  7. hexStr2ByteArr(String str)
  8. hexStr2Bytes(String src)
  9. hexStr2Str(String hexStr)