private static boolean doesPatternExistTwice(Map<Byte, byte[]> haystack,
                                                 byte[] needle) {
        int twice = 0;

        for (Byte key : haystack.keySet()) {
            if (Arrays.equals(haystack.get(key), needle)) {
                twice++;
                if (twice == 2) return true;
            }
        }

        return false;
    }