Android String to Hex Byte Array Convert getBytes(String hexString)

Here you can find the source of getBytes(String hexString)

Description

get Bytes

License

Open Source License

Declaration

public static byte[] getBytes(String hexString) 

Method Source Code

//package com.java2s;

public class Main {
    public static final String HEX_STRING_BLANK_SPLIT = " ";

    public static byte[] getBytes(String hexString) {
        String[] hexArray = hexString.split(HEX_STRING_BLANK_SPLIT);
        byte[] bytes = new byte[hexArray.length];
        for (int i = 0; i < hexArray.length; i++) {
            String hex = hexArray[i];
            bytes[i] = Integer.valueOf(hex, 16).byteValue();
        }//from w  w  w . j  a v a 2 s  .c  o  m
        return bytes;
    }
}

Related

  1. stringToHexByte(String str)
  2. hexStringToBytes(String hexString)
  3. hexStr2Bytes(String src)
  4. hexStringToBytes(String hex)
  5. hexStringToBytes(String hexString)
  6. stringToHex(String ids)
  7. hexStringToBytes(String s)
  8. hexStringToBytes(String hexString, int offset, int count)