Java Lowest Common Denominator