Rational numbers in Java