String (double from, double to) { int cmp = Double.compare(from, to); if (cmp == 0) return Double.toString(from); if (Double.compare(from, -0.0) == 0 && Double.compare(to, 0.0) == 0) { return "\u00B10.0"; // \u00B1 = +/- } if (from == Double.NEGATIVE_INFINITY) { if (to == Double.POSITIVE_INFINITY) return ""; return formatTo(to); } if (to == Double.POSITIVE_INFINITY) { return formatFrom(from); } return formatFrom(from) + " && " + formatTo(to); }