summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/uic/barcode
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/uic/barcode')
-rw-r--r--src/test/java/org/uic/barcode/test/utils/TestUtils.java11
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");