public boolean isPacketDistinct(@NonNull String originMacAddress, @NonNull byte[] scanRecord) {
        byte[] macBytes = originMacAddress.getBytes();
        ByteBuffer buffer = ByteBuffer.allocate(macBytes.length+scanRecord.length);
        buffer.put(macBytes);
        buffer.put(scanRecord);
        buffer.rewind(); // rewind puts position back to beginning so .equals and .hashCode work

        if (mDistinctPacketsDetected.size() == MAX_PACKETS_TO_TRACK) {
            return mDistinctPacketsDetected.contains(buffer);
        }
        else {
            return mDistinctPacketsDetected.add(buffer);
        }
    }
@Test
    public void testSamePacketForDifferentMacIsDistinct() throws Exception {
        DistinctPacketDetector dpd = new DistinctPacketDetector();
        dpd.isPacketDistinct("01:02:03:04:05:06", new byte[] {0x01, 0x02});
        boolean secondResult = dpd.isPacketDistinct("01:01:01:01:01:01", new byte[] {0x01, 0x02});
        assertTrue("second packet with different mac should be distinct", secondResult);
    }