diff options
author | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2023-07-28 14:10:32 +0200 |
---|---|---|
committer | CGantert345 <57003061+CGantert345@users.noreply.github.com> | 2023-07-28 14:10:32 +0200 |
commit | d49e5ec03afd09bbcdd703e4fd2faf453dbf686d (patch) | |
tree | 47cfa6db723d402956a23385fa83780204989b40 /src/test | |
parent | new bug fix version (diff) | |
download | UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.gz UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.bz2 UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.lz UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.xz UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.tar.zst UIC-barcode-d49e5ec03afd09bbcdd703e4fd2faf453dbf686d.zip |
Diffstat (limited to 'src/test')
-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");
|