Fraction extends Number implements FieldElement<Fraction>, Comparable<Fraction>, Serializable { @Override public int intValue() { return (int)doubleValue(); } Fraction(double value);  Fraction(double value, double epsilon, int maxIterations);  Fraction(double value, int maxDenominator); private  Fraction(double value, double epsilon, int maxDenominator, int maxIterations);  Fraction(int num);  Fraction(int num, int den); Fraction abs(); int compareTo(Fraction object); @Override double doubleValue(); @Override boolean equals(Object other); @Override float floatValue(); int getDenominator(); int getNumerator(); @Override int hashCode(); @Override int intValue(); @Override long longValue(); Fraction negate(); Fraction reciprocal(); Fraction add(Fraction fraction); Fraction add(final int i); Fraction subtract(Fraction fraction); Fraction subtract(final int i); Fraction multiply(Fraction fraction); Fraction multiply(final int i); Fraction divide(Fraction fraction); Fraction divide(final int i); double percentageValue(); static Fraction getReducedFraction(int numerator, int denominator); @Override String toString(); FractionField getField(); static final Fraction TWO; static final Fraction ONE; static final Fraction ZERO; static final Fraction FOUR_FIFTHS; static final Fraction ONE_FIFTH; static final Fraction ONE_HALF; static final Fraction ONE_QUARTER; static final Fraction ONE_THIRD; static final Fraction THREE_FIFTHS; static final Fraction THREE_QUARTERS; static final Fraction TWO_FIFTHS; static final Fraction TWO_QUARTERS; static final Fraction TWO_THIRDS; static final Fraction MINUS_ONE; }
@Test public void testIntValue() { Fraction first = new Fraction(1, 2); Fraction second = new Fraction(3, 2); Assert.assertEquals(0, first.intValue()); Assert.assertEquals(1, second.intValue()); }