/** * Return a String representing the number round to the given tolerance. If * the input double is equal to an integer using the given tolerance, this * method return a number without the ".0". * * @param number the double to transform * @param tol the tolerance * @return * @deprecated this method is repaced by prettyRound, more precise */ @Deprecated public static String roundToString(double number, double tol) { StringBuilder w = new StringBuilder(); if (isInteger(number, tol)) { w.append(Math.round(number)); } else { double res = 1 / tol; w.append(Math.rint(number * res) / res); } return w.toString(); }