MCPcopy Create free account
hub / github.com/capstone-engine/capstone / hexString2Byte

Method hexString2Byte

bindings/java/TestXcore.java:10–19  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

8
9public class TestXcore {
10 static byte[] hexString2Byte(String s) {
11 // from http://stackoverflow.com/questions/140131/convert-a-string-representation-of-a-hex-dump-to-a-byte-array-using-java
12 int len = s.length();
13 byte[] data = new byte[len / 2];
14 for (int i = 0; i < len; i += 2) {
15 data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
16 + Character.digit(s.charAt(i+1), 16));
17 }
18 return data;
19 }
20
21 static final String XCORE_CODE = "fe0ffe171317c6feec1797f8ec4f1ffdec3707f2455bf9fa02061b1009fdeca7";
22

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected