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

Method hexString2Byte

bindings/java/TestArm.java:11–20  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

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

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected