src/main/java/chlx/hashing/similarity/JaccardIndex.java
public static double index(@NotNull int[] s1, @NotNull int[] s2) {
		if (s1.length == 0 && s2.length == 0) {
			return 1.0;
		}
		int count = 0;

		int i1 = 0;
		int i2 = 0;
		while (i1 < s1.length && i2 < s2.length) {
			if (s1[i1] < s2[i2]) {
				++i1;
			} else if (s2[i2] < s1[i1]) {
				++i2;
			} else {
				++count;
				++i1;
				++i2;
			}
		}

		return (double) count / (s1.length + s2.length - count);
	}
/**
	 * Calculate similarity between 2 sorted int arrays
	 */
Calculate similarity between 2 sorted int arrays
Calculate similarity between 2 sorted int arrays
public static double index(@NotNull int[] s1, @NotNull int[] s2) {
		if (s1.length == 0 && s2.length == 0) {
			return 1.0;
		}
		int count = 0;
		int i1 = 0;
		int i2 = 0;
		while (i1 < s1.length && i2 < s2.length) {
			if (s1[i1] < s2[i2]) {
				++i1;
			} else if (s2[i2] < s1[i1]) {
				++i2;
			} else {
				++count;
				++i1;
				++i2;
			}
		}
		return (double) count / (s1.length + s2.length - count);
	}
public static double index ( @ NotNull int [ ] s1 , @ NotNull int [ ] s2 ) { if ( s1 . length == 0 && s2 . length == 0 ) { return 1.0 ; } int count = 0 ; int i1 = 0 ; int i2 = 0 ; while ( i1 < s1 . length && i2 < s2 . length ) { if ( s1 [ i1 ] < s2 [ i2 ] ) { ++ i1 ; } else if ( s2 [ i2 ] < s1 [ i1 ] ) { ++ i2 ; } else { ++ count ; ++ i1 ; ++ i2 ; } } return ( double ) count / ( s1 . length + s2 . length - count ) ; }
Calculate similarity between 2 sorted int arrays
Calculate similarity between 2 sorted int arrays