Replacing some MathUtils code by Guavas utility code