Package de.uni_trier.wi2.procake.utils
Class Converter
- java.lang.Object
-
- de.uni_trier.wi2.procake.utils.Converter
-
public class Converter extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringMICROSECONDSstatic StringMILLISECONDSstatic StringNANOSECONDSstatic StringSECONDS
-
Constructor Summary
Constructors Constructor Description Converter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longconvertNs(long time, String format)Converts a time value into the specified time format.static doubleround(double value, int places)Rounds a given number to n decimal places using the BigDecimal.ROUND_HALF_UP method.
-
-
-
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
-
convertNs
public static long convertNs(long time, String format)Converts a time value into the specified time format.- Parameters:
time- The time in nanoseconds.format- The format of the time (Nanoseconds, Microseconds, Milliseconds, Seconds).- Returns:
- The time in the specified format.
-
round
public static double round(double value, int places)Rounds a given number to n decimal places using the BigDecimal.ROUND_HALF_UP method.- Parameters:
value- number to roundplaces- decimal places- Returns:
- rounded number
-
-