Package com.actelion.research.util
Class DoubleFormat
- java.lang.Object
-
- com.actelion.research.util.DoubleFormat
-
public class DoubleFormat extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DoubleFormat()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
toShortString(long value, int exponent)
Converts the value with the given exponent into a short string representation using the scientific notation if it is more compact.static java.lang.String
toString(double theDouble)
Converts a double value into a String representation in scientific format rounded to 5 significant digits, e.g.static java.lang.String
toString(double value, int significantDigits)
Converts a double value into a String representation in scientific format rounded to a definable number of digits, e.g.static java.lang.String
toString(double value, int significantDigits, boolean skipTrailingZeros)
Converts a double value into a String representation in scientific format rounded to a definable number of digits, e.g.
-
-
-
Method Detail
-
toString
public static java.lang.String toString(double theDouble)
Converts a double value into a String representation in scientific format rounded to 5 significant digits, e.g. 1.2345e-6. Double values that are effectively integers are turned into the scientific format only, if they consist of more than 8 digits.- Parameters:
theDouble
-- Returns:
-
toString
public static java.lang.String toString(double value, int significantDigits)
Converts a double value into a String representation in scientific format rounded to a definable number of digits, e.g. 1.2345e-6. Double values that are effectively integers are turned into the scientific format only, if they consist of more than significantDigits+3 digits.- Parameters:
value
-significantDigits
-- Returns:
-
toString
public static java.lang.String toString(double value, int significantDigits, boolean skipTrailingZeros)
Converts a double value into a String representation in scientific format rounded to a definable number of digits, e.g. 1.2345e-6. Double values that are effectively integers are turned into the scientific format only, if they consist of more than significantDigits+3 digits. If skipTrailingZeros is true, then integer output is not rounded: 7173 instead of 7200.- Parameters:
value
-significantDigits
-skipTrailingZeros
- if true then trailing zeros after a decimal point are not shown and integers are not rounded- Returns:
-
toShortString
public static java.lang.String toShortString(long value, int exponent)
Converts the value with the given exponent into a short string representation using the scientific notation if it is more compact. Trailing zeros are not shown.- Parameters:
value
-exponent
-- Returns:
-
-