Package de.uni_trier.wi2.procake.utils
Class Formatter
- java.lang.Object
-
- de.uni_trier.wi2.procake.utils.Formatter
-
public class Formatter extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringMICROSECONDSstatic StringMILLISECONDSstatic StringNANOSECONDSstatic StringSECONDS
-
Constructor Summary
Constructors Constructor Description Formatter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringnsToDetailedString(long ns)Returns a string representation of the given number of nanoseconds.static StringnsToString(long ns)Returns a string representation of the given number of nanoseconds.static StringnsToString(long time, String format)Returns a string representation of the given number in a specified format.static StringtoRoundedNumberWithDecimalComma(double number, int maxFractionDigits)Returns a string representation of the given number with german locale, i.e., decimal comma.
-
-
-
Field Detail
-
NANOSECONDS
public static final String NANOSECONDS
- See Also:
- Constant Field Values
-
MICROSECONDS
public static final String MICROSECONDS
- See Also:
- Constant Field Values
-
MILLISECONDS
public static final String MILLISECONDS
- See Also:
- Constant Field Values
-
SECONDS
public static final String SECONDS
- See Also:
- Constant Field Values
-
-
Method Detail
-
nsToString
public static String nsToString(long ns)
Returns a string representation of the given number of nanoseconds.
-
nsToString
public static String nsToString(long time, String format)
Returns a string representation of the given number in a specified format.- Parameters:
time- The time in nanoseconds.format- The format of the time (Nanoseconds, Microseconds, Milliseconds, Seconds).- Returns:
- The time in the specified format.
-
nsToDetailedString
public static String nsToDetailedString(long ns)
Returns a string representation of the given number of nanoseconds.
-
toRoundedNumberWithDecimalComma
public static String toRoundedNumberWithDecimalComma(double number, int maxFractionDigits)
Returns a string representation of the given number with german locale, i.e., decimal comma.- Parameters:
number- to be formattedmaxFractionDigits- the maximum number of fraction digits to be shown; if * less than zero, the number is not rounded.- Returns:
- string representation
-
-