(String hex)
| 37 | } |
| 38 | |
| 39 | private static byte[] hexStringToByteArray(String hex){ |
| 40 | if (hex.length() % 2 != 0) |
| 41 | throw new IllegalArgumentException("Even-length string required"); |
| 42 | byte[] res = new byte[hex.length() / 2]; |
| 43 | for (int i = 0; i < res.length; i++) { |
| 44 | res[i]=(byte)((Character.digit(hex.charAt(i * 2), 16) << 4) | (Character.digit(hex.charAt(i * 2 + 1), 16))); |
| 45 | } |
| 46 | return res; |
| 47 | } |
| 48 | } |
no outgoing calls
no test coverage detected