Updated java version of median of medians.