please use java.lang.Math.min(int, int). Don't repeat it yourself.