class JaroWinkler {

    public final double similarity(@NonNull final String s1, @NonNull final String s2) {
        if (s1 == null) {
            throw new NullPointerException("s1 must not be null");
        }

        if (s2 == null) {
            throw new NullPointerException("s2 must not be null");
        }

        if (s1.equals(s2)) {
            return 1;
        }

        int[] mtp = matches(s1, s2);
        float m = mtp[0];
        if (m == 0) {
            return 0f;
        }
        double j = ((m / s1.length() + m / s2.length() + (m - mtp[1]) / m))
                / THREE;
        double jw = j;

        if (j > getThreshold()) {
            jw = j + Math.min(JW_COEF, 1.0 / mtp[THREE]) * mtp[2] * (1 - j);
        }
        return jw;
    }

}

class JaroWinklerTest {

     JaroWinkler jw;

    @Test
    public void testShort() {

        String s = "sl";
        String s2 = "s";
        assert(jw.similarity(s,s2) > .8);
    }

}