Java Hex Convert To fromHex(String hex)

Here you can find the source of fromHex(String hex)

Description

from Hex

License

Open Source License

Declaration

public static byte[] fromHex(String hex) 

Method Source Code

//package com.java2s;
//  License: https://servicestack.net/bsd-license.txt

public class Main {
    public static byte[] fromHex(String hex) {
        int len = hex.length();
        byte[] data = new byte[len / 2];
        for (int i = 0; i < len; i += 2) {
            data[i / 2] = (byte) ((Character.digit(hex.charAt(i), 16) << 4)
                    + Character.digit(hex.charAt(i + 1), 16));
        }/*from  w ww.  ja  v a 2s  .co  m*/
        return data;
    }
}

Related

  1. fromHex(String hex)
  2. fromHex(String hex)
  3. fromHex(String hex)
  4. fromHex(String hex)
  5. fromHex(String hex)
  6. fromHex(String hex)
  7. fromHex(String hexBytes)
  8. fromHex(String hexData)
  9. fromHex(String hexStr)