static int indexOfBinary(final double[] incr, final double v) {
		int imin = 0;
		int imax = incr.length;
		int index = -1;

		while (imax > imin && index == -1) {
			final int imid = (imin + imax) >>> 1;

			if (imid == 0 || (incr[imid] >= v && incr[imid - 1] < v)) {
				index = imid;
			} else if (incr[imid] <= v) {
				imin = imid + 1;
			} else if (incr[imid] > v) {
				imax = imid;
			}
		}

		return index;
	}
Perform a binary-search on the summed probability array.
jenetics/src/main/java/io/jenetics/ProbabilitySelector.java