add Bytes.java
diff --git a/sim-applet/Makefile b/sim-applet/Makefile
index 740ffd8..1ed8cf9 100644
--- a/sim-applet/Makefile
+++ b/sim-applet/Makefile
@@ -6,7 +6,11 @@
 PACKAGE_NAME    = org.osmocom.IMSIPseudo
 PACKAGE_VERSION = 1.0
 
-SOURCES = src/org/osmocom/IMSIPseudo/MobileIdentity.java src/org/osmocom/IMSIPseudo/IMSIPseudo.java
+SOURCES = \
+	  src/org/osmocom/IMSIPseudo/Bytes.java \
+	  src/org/osmocom/IMSIPseudo/MobileIdentity.java \
+	  src/org/osmocom/IMSIPseudo/IMSIPseudo.java \
+	  $(NULL)
 
 CAP_FILE = build/javacard/org/osmocom/IMSIPseudo/javacard/IMSIPseudo.cap
 
@@ -42,6 +46,7 @@
 .PHONY: test
 test:
 	mkdir -p ./test/classes
+	javac -target 1.1 -source 1.3 -classpath test/classes -g -d ./test/classes src/org/osmocom/IMSIPseudo/Bytes.java
 	javac -target 1.1 -source 1.3 -classpath test/classes -g -d ./test/classes src/org/osmocom/IMSIPseudo/MobileIdentity.java
 	javac -target 1.1 -source 1.3 -classpath test/classes -g -d ./test/classes src/org/osmocom/IMSIPseudo/Test.java
 	java -classpath test/classes org.osmocom.IMSIPseudo.Test
diff --git a/sim-applet/src/org/osmocom/IMSIPseudo/Bytes.java b/sim-applet/src/org/osmocom/IMSIPseudo/Bytes.java
new file mode 100644
index 0000000..c684fb9
--- /dev/null
+++ b/sim-applet/src/org/osmocom/IMSIPseudo/Bytes.java
@@ -0,0 +1,82 @@
+/* Copyright 2020 sysmocom s.f.m.c. GmbH
+ * SPDX-License-Identifier: Apache-2.0 */
+package org.osmocom.IMSIPseudo;
+
+public class Bytes {
+	public static byte nibble2hex(byte nibble)
+	{
+		nibble = (byte)(nibble & 0xf);
+		if (nibble < 0xa)
+			return (byte)('0' + nibble);
+		else
+			return (byte)('a' + nibble - 0xa);
+	}
+
+	public static byte[] hexdump(byte data[])
+	{
+		byte res[] = new byte[(byte)(data.length*2)];
+		for (byte i = 0; i < data.length; i++) {
+			res[(byte)(i*2)] = nibble2hex((byte)(data[i] >> 4));
+			res[(byte)(i*2 + 1)] = nibble2hex(data[i]);
+		}
+		return res;
+	}
+
+	public static boolean equals(byte a[], byte b[])
+	{
+		if (a.length != b.length)
+			return false;
+		for (short i = 0; i < (short)a.length; i++) {
+			if (a[i] != b[i])
+				return false;
+		}
+		return true;
+	}
+
+	public static boolean isDigit(byte digits[])
+	{
+		for (short i = 0; i < (short)digits.length; i++) {
+			if (digits[i] < '0' || digits[i] > '9')
+				return false;
+		}
+		return true;
+	}
+
+	public static byte[] toStr(byte byte_nr)
+	{
+		byte str[];
+		short nr = byte_nr;
+		byte d;
+		byte l = 0;
+		if (nr < 0) {
+			l = 1;
+			nr = (short)-nr;
+		}
+
+		if (nr > 99) {
+			l += 3;
+			d = 100;
+		}
+		else if (nr > 9) {
+			l += 2;
+			d = 10;
+		}
+		else {
+			str = new byte[1];
+			l += 1;
+			d = 1;
+		}
+
+		byte i = 0;
+		str = new byte[l];
+		if (byte_nr < 0)
+			str[i++] = '-';
+
+		while (d > 0) {
+			str[i++] = (byte)('0' + (nr / d));
+			nr %= d;
+			d /= 10;
+		}
+		return str;
+	}
+}
diff --git a/sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java b/sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java
index 17f79a7..d704500 100755
--- a/sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java
+++ b/sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java
@@ -129,24 +129,6 @@
 		showMsg(msg);
 	}
 
-	private byte nibble2hex(byte nibble)
-	{
-		nibble = (byte)(nibble & 0xf);
-		if (nibble < 0xa)
-			return (byte)('0' + nibble);
-		else
-			return (byte)('a' + nibble - 0xa);
-	}
-
-	private byte[] hexdump(byte data[])
-	{
-		byte res[] = new byte[(byte)(data.length*2)];
-		for (byte i = 0; i < data.length; i++) {
-			res[(byte)(i*2)] = nibble2hex((byte)(data[i] >> 4));
-			res[(byte)(i*2 + 1)] = nibble2hex(data[i]);
-		}
-		return res;
-	}
 
 	private void showIMSI() {
 		/* 3GPP TS 31.102 4.2.2: IMSI */