Android String to Byte Array Convert toByte(String hexString)

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

Description

to Byte

Declaration

public static byte[] toByte(String hexString) 

Method Source Code

//package com.java2s;

public class Main {
    public static byte[] toByte(String hexString) {
        int len = hexString.length() / 2;
        byte[] result = new byte[len];
        for (int i = 0; i < len; i++)
            result[i] = Integer.valueOf(
                    hexString.substring(2 * i, 2 * i + 2), 16).byteValue();
        return result;
    }/* www .  ja v  a2  s  .  c  o m*/
}

Related

  1. fromString(String binary)
  2. fromString(String str)
  3. hexStringToByteArray(String hexa)
  4. toByte(String hexString)
  5. toBytes(final String str)
  6. StringtoByte(String data)
  7. getLengthByByte(String str)
  8. bytesStorage(String str)