diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2023-07-28 14:14:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-28 14:14:36 +0200 |
commit | 69ff8d066c138552ffaf1c31eaaf0ab7ded94bcb (patch) | |
tree | 280e81fe489f5a3944e0c8b8199019377c57eef0 /src/test/java/org/uic | |
parent | Merge pull request #68 from UnionInternationalCheminsdeFer/customerCardV1 (diff) | |
parent | - decode TLB also in case of wrong non-numeric formating of number (diff) | |
download | UIC-barcode-1.4.3.tar UIC-barcode-1.4.3.tar.gz UIC-barcode-1.4.3.tar.bz2 UIC-barcode-1.4.3.tar.lz UIC-barcode-1.4.3.tar.xz UIC-barcode-1.4.3.tar.zst UIC-barcode-1.4.3.zip |
Diffstat (limited to '')
-rw-r--r-- | src/test/java/org/uic/barcode/test/utils/TestUtils.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/java/org/uic/barcode/test/utils/TestUtils.java b/src/test/java/org/uic/barcode/test/utils/TestUtils.java index 9791b02..cee5623 100644 --- a/src/test/java/org/uic/barcode/test/utils/TestUtils.java +++ b/src/test/java/org/uic/barcode/test/utils/TestUtils.java @@ -28,6 +28,17 @@ public class TestUtils { }
+ /* s must be an even-length string. */
+ public static byte[] hexStringToByteArray(String s) {
+ int len = s.length();
+ byte[] data = new byte[len / 2];
+ for (int i = 0; i < len; i += 2) {
+ data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ + Character.digit(s.charAt(i+1), 16));
+ }
+ return data;
+ }
+
public static Date parseDate (String source){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|