so I am trying to convert infinite decimal numbers to proper fractions for example, 2.333333333.... is 2 1/3 I made up this function public static String doubleToStringFraction(Double d) { StringBuffer result = new StringBuffer(" " + ((int) Math.floor(d))); int whole = (int) ((d - Math.floor(d)) * 10000); int gcd = gcd(whole, 10000); result.append(" " + (whole / gcd) + "/" + ...