public static double getDice(String input1, String input2) {

        // Verifying the input:
        if (input1 == null || input2 == null)
            return 0;
        // Quick check to catch identical objects:
        if (input1 == input2)
            return 1;
        // avoid exception for single character searches
        if (input1.length() < 2 || input2.length() < 2)
            return 0;

        final List<String> bigramList1 = bigram(input1);
        final List<String> bigramList2 = bigram(input2);

        List<String> copy = new ArrayList<String>(bigramList2);
        int matches = 0;
        for (int i = bigramList1.size(); --i >= 0; ) {
            String bigram = bigramList1.get(i);
            for (int j = copy.size(); --j >= 0; ) {
                String toMatch = copy.get(j);
                if (bigram.equalsIgnoreCase(toMatch)) {
                    copy.remove(j);
                    matches += 2;
                    break;
                }
            }
        }

        return (double) matches / (bigramList1.size() + bigramList2.size());
    }