Here you can find the source of toByte(String hexString)
Parameter | Description |
---|---|
hexString | the source string |
public static byte[] toByte(String hexString)
//package com.java2s; public class Main { /**/*from ww w .j a v a2 s. c om*/ * Retrieve the bytes data * @param hexString the source string * @return the source string's byte data. */ 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; } }