diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet.java index dbc5c017f9..eb9a91698a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet.java @@ -137,18 +137,6 @@ public class DanaRS_Packet { return sb.toString(); } - final private static char[] hexArray = "0123456789ABCDEF".toCharArray(); - - public static String bytesToHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - for (int j = 0; j < bytes.length; j++) { - int v = bytes[j] & 0xFF; - hexChars[j * 2] = hexArray[v >>> 4]; - hexChars[j * 2 + 1] = hexArray[v & 0x0F]; - } - return new String(hexChars); - } - public static byte[] hexToBytes(String s) { int len = s.length(); byte[] data = new byte[len / 2]; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java index 4a7cffc3d7..65f4326e20 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java @@ -782,8 +782,8 @@ public class DanaRSService extends Service { SendTimeInfo(); byte[] pairingKey = {inputBuffer[2], inputBuffer[3]}; // store pairing key to preferences - SP.putString(R.string.key_danars_pairingkey, DanaRS_Packet.bytesToHex(pairingKey)); - log.debug("Got pairing key: " + DanaRS_Packet.bytesToHex(pairingKey)); + SP.putString(R.string.key_danars_pairingkey, DanaRS_Packet.toHexString(pairingKey)); + log.debug("Got pairing key: " + DanaRS_Packet.toHexString(pairingKey)); break; // time and user password information. last packet in handshake case (byte) BleCommandUtil.DANAR_PACKET__OPCODE_ENCRYPTION__TIME_INFORMATION: