Java examples for java.lang:byte Array to hex
hex To Byte Array
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String hexString = "java2s.com"; System.out.println(java.util.Arrays .toString(hexToByteArray(hexString))); }/* w w w . j a va 2 s. c o m*/ public static byte[] hexToByteArray(String hexString) { byte[] bytes = new byte[hexString.length() / 2]; for (int i = 0; i < bytes.length; i++) { bytes[i] = (byte) Integer.parseInt( hexString.substring(2 * i, 2 * i + 2), 16); } return bytes; } }