Here you can find the source of toXmlString(float value)
private static String toXmlString(float value)
//package com.java2s; // Distributed under the OSI-approved BSD 3-Clause License. public class Main { private static String toXmlString(float value) { if (Float.isNaN(value)) { return "NaN"; } else if (value == Float.POSITIVE_INFINITY) { return "INF"; } else if (value == Float.NEGATIVE_INFINITY) { return "-INF"; } else {/* w w w . j av a2s .com*/ return Float.toString(value); } } private static String toXmlString(double value) { if (Double.isNaN(value)) { return "NaN"; } else if (value == Double.POSITIVE_INFINITY) { return "INF"; } else if (value == Double.NEGATIVE_INFINITY) { return "-INF"; } else { return Double.toString(value); } } }