/** * Produces a string form of a double given the value and the numerical base to convert it to. * There is an instance method that uses the internally stored base. This class method can be used * by anyone anytime. * * @param value the number to be converted * @param base the numerical base to use (currently 10 or 16) * @return a String equivalent of the value rendered appropriately. */ public static String formatNumber(double value, int base) { if (base == NumberDisplayBaseChooser.HEXADECIMAL) { long lguy = Double.doubleToLongBits(value); return Binary.intToHexString(Binary.highOrderLongToInt(lguy)) + Binary.intToHexString(Binary.lowOrderLongToInt(lguy)).substring(2); } else { return Double.toString(value); } }