Here you can find the source of toBytes(String hex)
Parameter | Description |
---|---|
hex | a parameter |
public static byte[] toBytes(String hex)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w .jav a 2 s . c o m * @param hex * @return */ public static byte[] toBytes(String hex) { byte[] bts = new byte[hex.length() / 2]; for (int i = 0; i < bts.length; i++) { bts[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2), 16); } return bts; } }