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

Method hexString2Byte

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

Source from the content-addressed store, hash-verified

9public class TestPpc {
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 PPC_CODE = "80200000803f00001043230ed04400804c4322022d0300807c4320147c4320934f2000214cc8002140820014";
23

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected