class ArrayUtils {

	public static int fuzzySearch(final float[] base, final float value, final boolean orGreater) {

		// no point in searching an empty array
		if (base == null || base.length == 0)
			return -1;

		// quick check if the searched value is inside
		if (value < base[0]) {
			if (orGreater)
				return 0;
			else
				return -1;
		}

		final int last = base.length - 1;
		if (value > base[last]) {
			if (orGreater)
				return -1;
			else
				return last;
		}

		return fuzzySearch(base, value, 0, base.length - 1, orGreater);
	}

}