Classes can sure suck some times.

So, how do you mean to insert code 2 into code 1? Both of them appear to be a series of methods. In the first snippet, there would be no reason to remove empties from the sum (they make no difference), nor do you really need to remove them from the mean (you'd just leave them out when counting the number of elements). Do you need to remove them for the binary search? That doesn't seem necessary, since the array would be sorted, and it wouldn't really matter whether there were some 0s in the array.