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

Method hexString2Byte

bindings/java/TestX86.java:14–23  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

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

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected