Java Utililty Methods Milliseconds Parse

List of utility methods to do Milliseconds Parse

Description

The list of methods to do Milliseconds Parse are organized into topic(s).

Method

LongparseTimeSpanMillis(final String text)

Parse a time span expression and returns the milliseconds represented by this one.

Long result = null;
if (text != null) {
    try {
        result = Long.valueOf(text);
    } catch (@SuppressWarnings("unused") final NumberFormatException e) {
        result = parseTimeSpanExpression(text);
return result;
longparseTimeStrToMilliseconds(String timeStr)
parse Time Str To Milliseconds
try {
    return Long.valueOf(timeStr);
} catch (Exception ex) {
    return humanDateToSeconds(timeStr) * ONESECOND;
longparseToMillis(String s)
parse To Millis
try {
    return DATE_FORMAT.get().parse(s).getTime();
} catch (ParseException ex) {
    throw new RuntimeException(ex);
voidpauseMilliseconds(long duration)
Make a pause
try {
    Thread.sleep(duration);
} catch (Exception e) {
    Thread.currentThread().interrupt();
voidpauseMilliSeconds(long pauseMilliSeconds)
pause Milli Seconds
System.out.format("INFO:Utils::pauseMilliSeconds: %d ...", pauseMilliSeconds);
try {
    Thread.sleep(pauseMilliSeconds);
} catch (InterruptedException e) {
System.out.format("consumed\n");