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

Method hexString2Byte

bindings/java/TestM680x.java:27–36  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

25 static final String HCS08_CODE = "3210009eae9ece7f9ebe10009efe7f3e10009ef37f9610009eff7f82";
26
27 static byte[] hexString2Byte(String s) {
28 // from http://stackoverflow.com/questions/140131/convert-a-string-representation-of-a-hex-dump-to-a-byte-array-using-java
29 int len = s.length();
30 byte[] data = new byte[len / 2];
31 for (int i = 0; i < len; i += 2) {
32 data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
33 + Character.digit(s.charAt(i+1), 16));
34 }
35 return data;
36 }
37
38 static public String stringToHexUc(byte[] code) {
39 StringBuilder buf = new StringBuilder(800);

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected