java: public static int getNearestSetSize(int maxNumberOfValuesExpected,float desiredSaturation) {for (int i = 0; i < usableBitSetSizes.length; i++) {int numSetBitsAtDesiredSaturation = (int) (usableBitSetSizes[i] * desiredSaturation);int estimatedNumUniqueValues = getEstimatedNumberUniqueValuesAllowingForCollisions(usableBitSetSizes[i], numSetBitsAtDesiredSaturation);if (estimatedNumUniqueValues > maxNumberOfValuesExpected) {return usableBitSetSizes[i];}}return -1;}
C#: public static int GetNearestSetSize(int maxNumberOfValuesExpected,float desiredSaturation){foreach (var t in from t in _usableBitSetSizeslet numSetBitsAtDesiredSaturation = (int) (t*desiredSaturation)let estimatedNumUniqueValues = GetEstimatedNumberUniqueValuesAllowingForCollisions(t, numSetBitsAtDesiredSaturation) where estimatedNumUniqueValues > maxNumberOfValuesExpected select t){return t;}return -1;}