public float getJaroWinklerMetric(String string1, String string2) {

                
        List<String> lstCommonChar1 = getCommonCharacters(string1, string2);
        List<String> lstCommonChar2 = getCommonCharacters(string2, string1);

        //check for zero in common
        if (lstCommonChar1.size() == 0 || lstCommonChar2.size() == 0 || lstCommonChar1.size() != lstCommonChar2.size()) {
            return 0.0f;
        }

        //get the number of transpositions
        int transpositions = 0;
        int n = lstCommonChar1.size();
        for (int i = 0; i < n; i++) {
            if (!lstCommonChar1.get(i).equals(lstCommonChar2.get(i)))
                transpositions++;
        }
        transpositions /= 2.0f;

        //calculate jaro metric
        return (n / ((float) string1.length()) +
                n / ((float) string2.length()) +
                (n - transpositions) / ((float) n)) / 3.0f;
    }