Question: how to calculate ratio of two numbers in java?
Answer: Multiply both values by 10 until the significand is entirely to the left of the decimal point.
Find the Greatest Common Denominator of the two values.
Divide by GCD.