protected static String numberToString(Number number)
	{
        if (number == null) {
            return "null";
        }
        if (!testValidity(number)) {
			throw new RuntimeException("Can't convert number: " + number);
		}

		// Shave off trailing zeros and decimal point, if possible.

        String string = number.toString();
        if (string.indexOf('.') > 0 && string.indexOf('e') < 0
                && string.indexOf('E') < 0) {
            while (string.endsWith("0")) {
                string = string.substring(0, string.length() - 1);
            }
            if (string.endsWith(".")) {
                string = string.substring(0, string.length() - 1);
            }
        }
        return string;
    }