A class in java for fractions