public class Formatter
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
private |
Formatter()
Prevents this class from being instantiated from outside.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
formatPercentage(double fraction,
double total)
Formats a percentage calculated from
fraction and
total. |
static java.lang.String |
formatPercentage(double fraction,
double total,
java.lang.String prefix)
Formats a percentage calculated from
fraction and
total. |
static java.lang.String |
formatPercentage(long fraction,
long total)
Formats a percentage calculated from
fraction and
total. |
static java.lang.String |
formatPercentage(long fraction,
long total,
java.lang.String prefix)
Formats a percentage calculated from
fraction and
total. |
static java.lang.String |
formatPercentageOrValue(long fraction,
long total,
boolean showPercentage)
Formats
fraction or returns the percentage dependent on
showPercentage. |
static java.lang.String |
nanoToUsualTime(long nano)
Formats nano time to milliseconds, seconds or minutes.
|
static void |
printStackTace()
A helper method for printing the current stack trace in the order of
call to the standard output stream.
|
private Formatter()
public static java.lang.String nanoToUsualTime(long nano)
nano - the time (difference) in nano seconds to be formattedpublic static java.lang.String formatPercentageOrValue(long fraction,
long total,
boolean showPercentage)
fraction or returns the percentage dependent on
showPercentage.fraction - the part of totaltotal - a number representing 100%showPercentage - if true show the percentage,
if false the value of fractionpublic static java.lang.String formatPercentage(double fraction,
double total)
fraction and
total. Percentages are given in 2 digits after
the floating point separator.fraction - the part of totaltotal - a number representing 100%public static java.lang.String formatPercentage(double fraction,
double total,
java.lang.String prefix)
fraction and
total. Percentages are given in 2 digits after
the floating point separator.fraction - the part of totaltotal - a number representing 100%prefix - if not present (null), return fraction
as value and percentage, else return the prefix and the percentagepublic static java.lang.String formatPercentage(long fraction,
long total)
fraction and
total. Percentages are given in 2 digits after
the floating point separator.fraction - the part of totaltotal - a number representing 100%public static java.lang.String formatPercentage(long fraction,
long total,
java.lang.String prefix)
fraction and
total. Percentages are given in 2 digits after
the floating point separator.fraction - the part of totaltotal - a number representing 100%prefix - if not present (null), return fraction
as value and percentage, else return the prefix and the percentagepublic static void printStackTace()